Ok, I spent hours trying to find a way to reload a ajax request without an event happening and I could surprisingly not find any examples with a google search, I once remember seeing something like a wait 5 seconds then request again but I can't find it anymore.
Anyways, after giving up and I started doing other stuff I got the idea to have it redo the ajax request once the last request was complete (at stage 4) of course it worked perfectly in FireFox so I am like yaaaa!, then I decided to test it in IE but all I get is a stack overflow here is a image of the exact message:
Here is the code for my document all it basically is, is a live clock:
Anyways ya I was wondering if someone could point out how I could make it work in IE I have an idea but not sure if it will work? Maybe like pause the for 1 second at stage 4 so that it doesn't redo the request so quickly:
Thanks for reading this and I hope someone can help!
Anyways, after giving up and I started doing other stuff I got the idea to have it redo the ajax request once the last request was complete (at stage 4) of course it worked perfectly in FireFox so I am like yaaaa!, then I decided to test it in IE but all I get is a stack overflow here is a image of the exact message:
Here is the code for my document all it basically is, is a live clock:
| Code: |
|
<html> <head> <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ document.myForm.time.value = ajaxRequest.responseText; ajaxFunction(); } } ajaxRequest.open("GET", "serverTime.php", true); ajaxRequest.send(null); } //--> </script> </head> <body onLoad="ajaxFunction();"> <form name='myForm'> Name: <input type='text' name='username' /> <br /> Time: <input type='text' name='time' /> </form> </body> </html> |
Anyways ya I was wondering if someone could point out how I could make it work in IE I have an idea but not sure if it will work? Maybe like pause the for 1 second at stage 4 so that it doesn't redo the request so quickly:
| Code: |
|
// Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ document.myForm.time.value = ajaxRequest.responseText; ::Some Pause Text Here:: ajaxFunction(); } } |
Thanks for reading this and I hope someone can help!
