Hi ,
I have an ajax code which works well in IE. I receive the responseText and thus the alert messages. However, i receive no responseText in Firefox.
The code snippet is as follows.
function pingip()
{
var ipaddress=document.baseform1.serviptxt.value;
var xmlHttp;
try
{
xmlHttp=new XMLHttpRequest();
} catch (exception)
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
} catch (exception)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
} catch (exception) {
alert("Your browser does not support AJAX!");
return false;
}
}
}
alert("Pinging the Ip. Please wait.");
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
var responseText = xmlHttp.responseText; //is shown blank in firefox.
if(responseText=="Success")
{
alert("Reply received! Server is up.");
returncode=false;
}
else if(responseText=="Failure")
{
alert("Error in connection.");
returncode=false;
}
}
}
xmlHttp.open("GET", "PingIP?ipaddress=" + ipaddress, true);
xmlHttp.setRequestHeader("Content-Type", "text/xml");
xmlHttp.send(null);
}
Could anyone help me solve this problem.
Thanks a ton in advance.
Saswati