SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict Shaydez's Avatar
    Join Date
    Jul 2006
    Location
    Boca Raton, Florida
    Posts
    355
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    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.


    Code JavaScript:
    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);

  2. #2
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    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

  3. #3
    SitePoint Addict Shaydez's Avatar
    Join Date
    Jul 2006
    Location
    Boca Raton, Florida
    Posts
    355
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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.

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,604
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    GET is supposed to cache the reply. If you don't want it caching then use POST.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •