What's it like working at Marshalls?

Whats wrong in this ajax code? this is working fine in IE but not working in firefox.?

  • here is my code, its working fine in IE but not in FF? can you pls write the correct code if possible. <script type="text/javascript" language="javascript"> function displaydetail(id) { if(window.ActiveXObject) { var req=new ActiveXObject('Microsoft.XMLHttp'); } else if(window.XMLHttpRequest) { var req=new XMLHttpRequest(); } req.open('GET','dosql.php?id='+id,tru… connection //alert(id); req.onreadystatechange=function() { if(req.readystate==4) { if(req.status==200) { var resp=req.responsetext; document.getElementById('detail').… } } } req.send(); } </script>

  • Answer:

    Hmmm. You need some error checking code. Try checking to see if req.send() is successful or even if req was created properly. If all of that is working, check what req.status is when the request completes. Or even readystate...

parwan00... at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

Try This... <script type="text/javascript" language="javascript"> function displaydetail(id) { if(window.ActiveXObject) { var req=new ActiveXObject('Microsoft.XMLHttp'); } else if(window.XMLHttpRequest) { var req=new XMLHttpRequest(); } req.open('GET','dosql.php',true); //change these req.onreadystatechange=function() { if(req.readyState==4) { if(req.status==200) { var resp=req.responseText; //change these alert(resp); //change these } } } req.send(null); } </script> CHANGES MADE: req.send() -> req.send(null) responsetext -> responseText readystate -> readyState Cheers!

There is just a support of IE Try to add code for Firefox much better to use some lib those are compatible with all browsers There are Jquery or prototype http://www.zahipedia.com

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.