This code seems really long – but i dont fully understand the jquery .ajax function to convert this code – My main problem is i dont know how to implement the responseText-bit
Any help is very much appreciated:
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();
}
Or simply:
And of cause with the function wrap: