anujphp Posted December 21, 2008 Share Posted December 21, 2008 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 // 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 Quote Link to comment Share on other sites More sharing options...
Flames Posted December 26, 2008 Share Posted December 26, 2008 WATCH THE CAPITALS, IT PUTS PEOPLE OFF... Quote Link to comment Share on other sites More sharing options...
Mikedean Posted December 26, 2008 Share Posted December 26, 2008 I've had this type of problem before, try changing the GET to a POST. You'll have to change parts of it, but it should do the trick . Quote Link to comment Share on other sites More sharing options...
PICS Posted December 31, 2008 Share Posted December 31, 2008 mozilla = netscape :/ Quote Link to comment Share on other sites More sharing options...
anujphp Posted January 2, 2009 Author Share Posted January 2, 2009 yes mozilla=netscape but the browser is dofferent..i have changed but it id not working with get and post both Quote Link to comment Share on other sites More sharing options...
priti Posted January 3, 2009 Share Posted January 3, 2009 Hi Anuj Have you tracker wether script create xmlHttp object ??? kindly alert and see !! what error IE is throwing there would be some error in your left and side in status bar let us know that. Thanks. Quote Link to comment Share on other sites More sharing options...
anujphp Posted January 4, 2009 Author Share Posted January 4, 2009 hello Priti I am a beginer of php and javascript,i dont no how to track whether script is creating xmlHttp object or not but it is definitely entering the loop where the code for xmlHttp object is created i,e the code segmentgiven below //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } I wrote a alert statement below this line and i got the alert. i think it is creating the object,if it does not create then it will give me an error message as browser does not support http request as i am checking xmlHttp by the below code if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } hope i am thinking and doing things correct. regarding the error message i have not received any error message in the status bar,status bar is blank thanks Quote Link to comment Share on other sites More sharing options...
priti Posted January 4, 2009 Share Posted January 4, 2009 yes by alert only u can track....and yes you are also doing the correct way. ummm ..do one thing Are you sure it is not working on IE which version 7/6? Track here also function stateChanged() { alert(xmlHttp.readyState); // check which all state request goes thru !! if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtHint").innerHTML=xmlHttp.responseText } } Quote Link to comment Share on other sites More sharing options...
anujphp Posted January 5, 2009 Author Share Posted January 5, 2009 Thanks you all particularly Priti ..i have solved the problem i was facing,the code is working fine now. Priti your blog/website is a good one. Quote Link to comment Share on other sites More sharing options...
anujphp Posted January 5, 2009 Author Share Posted January 5, 2009 thanks Quote Link to comment Share on other sites More sharing options...
priti Posted January 5, 2009 Share Posted January 5, 2009 Thanks Anuj specially for appreciation :-) Regards Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.