2
此代碼似乎真的很長 - 但我不完全理解阿賈克斯功能是把這段代碼轉換jQuery的 - 我的主要問題是我不知道如何實現這個responseText位如何將此javascript ajax代碼轉換爲查詢ajax?
任何幫助是非常讚賞:
function getCategory(category){
if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("products").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","productlist.php?q="+category,true);
xmlhttp.send();
}
哇這個很簡單..謝謝! –