Jump to content

Recommended Posts

So I have this project I'm suppose to be doing. It's to make a web page using AJAX to update a page every 5 seconds, stop/start when a button is pushed, and dynamically update when the back end XML is updated. The problem I have is that it isn't updating (FTP) right after I change the XML. It takes like 5 to 10 mins for it to actually update. here is the code:

<script type="text/javascript">var z = 0;var repeatIDfunction halter(url){  if (repeatID){   clearInterval(repeatID)   repeatID = null   document.getElementById('ChangeMe').innerHTML = "Message paused";  }  else{   loadXMLdoc(url)    }}function loadXMLdoc(url) {   var xmlhttp   var txt   if (window.XMLHttpRequest) {	xmlhttp = new XMLHttpRequest();   } else {	xmlhttp = new ActiveXObject("microsoft.XMLHTTP");   }   repeatID = window.setInterval(function() {   xmlhttp.open("GET", url, true);   xmlhttp.send();   xmlhttp.onreadystatechange = function() {	if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {	 x = xmlhttp.responseXML.documentElement	   .getElementsByTagName('message');	 if (z < x.length) {	  xx = x[z].getElementsByTagName("content")	  txt = xx[0].firstChild.nodeValue	  z += 1	  if (z == x.length){	  z = 0	  }	}	}	 document.getElementById('ChangeMe').innerHTML = txt;   }  }, 1000);}</script>

Is it in my script or is my browser doing something it's not suppose to??

Edited by will71110
Link to post
Share on other sites

Well I figured out that Chrome caches content for around 20 mins. After the 20 mins, my content will update. I'm still new at this so make a link that is time stamped is beyond me currently. Hopefully soon I'll get a better understanding of this and can do like you said justsomeguy.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...