I'm attempting to add a timestamp to my URL that is being called by AJAX every 5 seconds. The purpose is to prevent caching in Internet Explorer browsers. However, it seems like the AJAX call is not functioning properly now without any error messages....
The following code is functional:
<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>
However, when I attempt to append the timestamp to the URL, it doesn't 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 assistance would be greatly appreciated. Thank you