garethhall Posted September 1, 2009 Share Posted September 1, 2009 Hi I have this very simple ajax page and It just won't work in firefox. When I check the XHR response in firebug I get the expected result in this case "test". I don't get way it's not working all the other main browsers seems to work fine it's just firefox? Anyone know why? Holding page ("books.php") <script type="text/javascript" src="ajax/js/myBooks.js"></script> </head> <body id="myAccount" onload="getMyBooks()"> <div id="container"> <!--Head and nav--> <?php include('includes/header.php');?> <!--Account nav--> <?php include('includes/accountNav.php');?> <div id="main_content"> <!-- main content to be displayed --> <div id="main_header"> My Books </div> <div id="contentArea"> <!-- div to hold all content inside the --> <div class="clear"></div> <div id="myBookLibrary"></div> <div class="clear"></div> </div> <div id="main_content_footer"></div> </div> <!--Footer--> <?php include('includes/footer.php');?> </div> <!-- end container div --> </body> Ajax page ("mybook.js") var xmlHttp var url="ajax/myBooks.php?"; function getMyBooks(){ xmlHttp=GetXmlHttpObject() if(xmlHttp==null){ alert("Browser does not support HTTP Request"); return; } var qstr; xmlHttp.onreadystatechange=myBookResults; xmlHttp.open("POST",url,false); xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlHttp.send(qstr); } function myBookResults(){ if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ document.getElementById("myBookLibrary").innerHTML=xmlHttp.responseText; }; }; 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; }; PHP page ("myBooks.php") <?php echo "test"; ?> Quote Link to comment Share on other sites More sharing options...
abazoskib Posted September 2, 2009 Share Posted September 2, 2009 go to tools >> error console. See if Firefox is reporting any errors Quote Link to comment Share on other sites More sharing options...
garethhall Posted September 2, 2009 Author Share Posted September 2, 2009 There are no errors Quote Link to comment Share on other sites More sharing options...
garethhall Posted September 3, 2009 Author Share Posted September 3, 2009 Anyone? Quote Link to comment Share on other sites More sharing options...
abazoskib Posted September 5, 2009 Share Posted September 5, 2009 go to about:config and try changing network.http.use-cache to false. then try it 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.