AJAX CODE WORKING WITH MOZILA & NETSCAPE BUT NOT WITH IE

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
anujphp
Forum Commoner
Posts: 25
Joined: Wed Nov 05, 2008 10:12 am

AJAX CODE WORKING WITH MOZILA & NETSCAPE BUT NOT WITH IE

Post by anujphp »

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

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 
 } 
}
THANK YOU IN ADVANCE
User avatar
Syntac
Forum Contributor
Posts: 327
Joined: Sun Sep 14, 2008 7:59 pm

Re: AJAX CODE WORKING WITH MOZILA & NETSCAPE BUT NOT WITH IE

Post by Syntac »

Sorry, your gratuitous use of uppercase letters has made me not want to help you.
anujphp
Forum Commoner
Posts: 25
Joined: Wed Nov 05, 2008 10:12 am

Re: AJAX CODE WORKING WITH MOZILA & NETSCAPE BUT NOT WITH IE

Post by anujphp »

sorry if i have offended you,i did not mean to offend anyone.i cant force anyone to help me,i have requested everynone to help me in solving my this problem which i am facing.
anujphp
Forum Commoner
Posts: 25
Joined: Wed Nov 05, 2008 10:12 am

Re: AJAX CODE WORKING WITH MOZILA & NETSCAPE BUT NOT WITH IE

Post by anujphp »

thank you.this problem is solved now
Post Reply