Whenever I run this file the code runs up to the point where the send function fires and then it only fires if I have an alert function directly behind it, if I take out the alert("sent"); out then it replies with ServerReadyyState is:1.
What could possibly be the problem? Someone please help, I've tried it on my local machine and on my personal server and got the same results. Any help is greatly appreciated.
The Code:
/**
* @author d
*/
var xhr;
function getPlants(xhr){
try {
xhr=new XMLHttpRequest();
}catch(microsoft){
try{
xhr=new ActiveXObject("Msxml2.XMLHTTP");
}catch(othermicrosoft){
try{
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}catch(failed){
xhr=false;
alert("ajax not supported");
}
}
}
xhr.open("GET","db_interactions.php",true);
xhr.send(null);
alert("sent");//the send function only works if this alert functions is here
if(xhr.readyState==4){
return xhr.responseText;
}
else{
alert("Server ReadyState is:"+xhr.readyState);
xhr.abort();
//getPlants(xhr);
}
}