Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
Append Timestamp to Ajax URL GET

I am trying to append a timestamp to my URL which is called by AJAX every 5 seconds. I am doing this to stop caching in Internet Explorer browsers. However the AJAX call appears to be not calling now but there are no errors....

This code works

<script>
  function loaddoc()
  {
   var xmlhttp=new XMLHttpRequest();
   xmlhttp.onreadystatechange=function(){
    if (xmlhttp.readyState==4 && xmlhttp.status==200) {
     document.getElementById("trainblock").innerHTML=xmlhttp.responseText;
    } 
   }
   xmlhttp.open("GET","networkgettrainsleicester.php",true);
   xmlhttp.send();
  }
 </script>

With the extra code to append the timestamp does not work

 <script>
  function loaddoc()
  {
   var xmlhttp=new XMLHttpRequest();
   xmlhttp.onreadystatechange=function(){
    if (xmlhttp.readyState==4 && xmlhttp.status==200) {
     document.getElementById("trainblock").innerHTML=xmlhttp.responseText;
    } 
   }
   d=new Date();
   xmlhttp.open("GET","networkgettrainsleicester.php+'?'+d.getTime()",true);
   xmlhttp.send();
  }
 </script>

Any help appreciated Thanks

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You not appending the time-stamp. You are including it as a string

xmlhttp.open("GET","networkgettrainsleicester.php+'?'+d.getTime()",true);

Change to

xmlhttp.open("GET","networkgettrainsleicester.php?t=" + d.getTime(),true);
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!