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"; ?> Link to comment https://forums.phpfreaks.com/topic/172765-solved-ajax-not-working-in-firefox-only/ 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 Link to comment https://forums.phpfreaks.com/topic/172765-solved-ajax-not-working-in-firefox-only/#findComment-910614 Share on other sites More sharing options...
garethhall Posted September 2, 2009 Author Share Posted September 2, 2009 There are no errors Link to comment https://forums.phpfreaks.com/topic/172765-solved-ajax-not-working-in-firefox-only/#findComment-910629 Share on other sites More sharing options...
garethhall Posted September 3, 2009 Author Share Posted September 3, 2009 Anyone? Link to comment https://forums.phpfreaks.com/topic/172765-solved-ajax-not-working-in-firefox-only/#findComment-911346 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 Link to comment https://forums.phpfreaks.com/topic/172765-solved-ajax-not-working-in-firefox-only/#findComment-912976 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.