AJAX CODE WORKING WITH MOZILA & NETSCAPE BUT NOT WITH IE
Posted: Fri Jan 02, 2009 7:16 am
i am checking the presence of username while registering for my site and displaying the result using AJAX,it is working fine with mozilla and netscape and flock but now working with Internet explorer,i tried with different version of IE but none works,please help me,i am giving the js file code
THANK YOU IN ADVANCE
Code: Select all
// JavaScript Document
var xmlHttp //this will return the xmlhttp request
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
//Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
//function to receive the new username and check whether th browser support ajax
function showUser(str)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="checkuser.php"
url=url+"?user="+str
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
//function to receive data from php page
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("txtHint").innerHTML=xmlHttp.responseText
}
}