Jump to content

XMLhttprequest - can't change states


infamous_Q

Recommended Posts

Ok, I don't know what I'm doing wrong here. I've written some script that is using javascript to send information to a MySQL db through a php page, and receive as well. Now, here's the kicker: I can send things fine, but I cannot receive anything, and it seems the request doesn't change it's state. So in order to trouble shoot I've set up a script that will pop up an alert message box every time the request's state changes, but it never gets passed 1. My code is below (it's snipped a bit, and I only included the non-working code).

 

function getInf()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Your browswer doesn't support XML");
return;
}

var idinf="3"; 
//this number doesn't even matter really for troubleshooting
var url="get_inf.php?id=" + idinf;

xmlHttp.open("GET",url,true);

xmlHttp.onreadystatechange(checkData());
xmlHttp.send(idinf);

}

function checkData()
{
alert(xmlHttp.readyState);
}

 

Can anybody help me out?

Link to comment
https://forums.phpfreaks.com/topic/99904-xmlhttprequest-cant-change-states/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.