Hai
i'm new to the ajax please help me to resolve this my problem. Following is the ajax code i'm using. If the ready state is 4 i'm assinging 1 to 'y'. after that if i'm going to print y it's showing undefined. what is the wrong with my code.
Thanks in advance
var xmlHttp = getXMLHttp();
xmlHttp.onreadystatechange = function()
{
if(xmlHttp.readyState == 4)
{
if(xmlHttp.responseText == "Wrong")
{
y = 1;
}
}
}
xmlHttp.open("GET", "/inc/test.php?temp="+temp, true);
xmlHttp.send(null);
var xmlHttp = getXMLHttp();
xmlHttp.onreadystatechange = function()
{
if(xmlHttp.readyState == 4)
{
if(xmlHttp.responseText)
{
y = 1;
}
}
}
xmlHttp.open("GET", "/inc/test.php?captcha="+temp, true);
xmlHttp.send(null);
alert(y);