Internet Explorer Cache

I’m just getting into ajax … i think i’m missing something simple in my script … It works perfect in Firefox and Opera and anything that is not ****** Microsoft

i’m sure i’m missing a clear cache script or something for the Internet Explorer area.

function ShowEmail(str)
{

var str='1'

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getmail.php?q="+str,true);
xmlhttp.send();


}

setInterval("ShowEmail()",5000);

oh sorry…

Well the script grabs information from the database every few seconds… it works perfect in Firefox, Opera etc… but not in Internet Explorer … when i close explorer or do a hard refresh it’ll load the information so i’m assuming its a IE Cache problem.

GET is supposed to cache the reply. If you don’t want it caching then use POST.

You don’t actually state what’s going wrong, but I assume it’s related to caching.

Try grabbing a javascript timestamp and appending it to the URL:

“getmail.php?q=” + str + “&_t=” + timestamp