shadiadiph Posted April 22, 2010 Share Posted April 22, 2010 Not too clued up on AJAX but the following scripts seems to work in safari, chrome, opera, firefox and seamonkey but in internet explorer 8 it refreshes once then does nothing else all the others update every 20 seconds internet explorer is showing no javascript errors??? <script type="text/javascript"> function Ajax(){ var xmlHttp; try{ xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari }catch (e){ try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer }catch (e){ try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }catch (e){ alert("No AJAX!?"); return false; } } } xmlHttp.onreadystatechange=function(){ if (xmlHttp.readyState == 4) { if(xmlHttp.status == 200) { document.getElementById('usersonline').innerHTML=xmlHttp.responseText; setTimeout('Ajax()',"20000"); } } } var sessid= "<?=$sessid?>"; xmlHttp.open("GET", "topmain.php?sessid="+sessid, true); xmlHttp.send(null); } window.onload=function(){ setTimeout('Ajax()',"20000"); } </script> </head> <body> <div id="wrapper"> <div id="headertopleft"> <div id="usersonline"><?php include_once("topmain.php"); ?></div> </div> Link to comment https://forums.phpfreaks.com/topic/199356-ajax-not-working-in-internet-explorer-8/ Share on other sites More sharing options...
shadiadiph Posted April 22, 2010 Author Share Posted April 22, 2010 solved it i just needed to add a header request to stop internet explorer caching. i just added setRequestHeader var sessid= "<?=$sessid?>"; xmlHttp.open("GET", "online.php?sessid="+sessid, true); xmlHttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); xmlHttp.send(null); Link to comment https://forums.phpfreaks.com/topic/199356-ajax-not-working-in-internet-explorer-8/#findComment-1046309 Share on other sites More sharing options...
grammo Posted November 30, 2010 Share Posted November 30, 2010 Thank you for this.. Just fixed my problem after searching endlessly for hours! Link to comment https://forums.phpfreaks.com/topic/199356-ajax-not-working-in-internet-explorer-8/#findComment-1141465 Share on other sites More sharing options...
karlosdpm Posted November 16, 2012 Share Posted November 16, 2012 This post might be usefull for you: http://www.kmbytes.com/blog/how-to-make-ajax-to-work-in-internet-explorer/ It worked for me. Link to comment https://forums.phpfreaks.com/topic/199356-ajax-not-working-in-internet-explorer-8/#findComment-1393112 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.