Issue with cache with XMLHttpRequest

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • OraWiz

    Issue with cache with XMLHttpRequest


    Hi !

    I have a problem using XMLHttpRequest (AJAX impl).

    I am getting the cached data all the time.


    heres the code.

    function loadDoc( url )
    {
    // branch for native XMLHttpRequest object
    if (window.XMLHttp Request) {
    req = new XMLHttpRequest( );
    req.onreadystat echange = processReqChang e;
    req.open("GET", url, true);
    req.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveX Object) {
    req = new ActiveXObject(" Microsoft.XMLHT TP");
    if (req) {
    req.onreadystat echange = processReqChang e;
    req.open("GET", url, true);
    req.send();
    }
    }
    }


    NOTE : the url I'm requesting is not under my control.

    Njoy....

  • VK

    #2
    Re: Issue with cache with XMLHttpRequest

    Randomize your link:
    ....
    url = XMLToRead;
    var d = new Date();
    if (url.search) { // in case if you're requesting a server script for
    file
    url.search += "&" + d.getTime();
    }
    else {
    url.search = d.getTime();
    }
    ....
    d = null;

    Comment

    • OraWiz

      #3
      Re: Issue with cache with XMLHttpRequest

      Thank you VK.. Problem Solved.


      Njoy....

      VK wrote:[color=blue]
      > Randomize your link:
      > ...
      > url = XMLToRead;
      > var d = new Date();
      > if (url.search) { // in case if you're requesting a server script for
      > file
      > url.search += "&" + d.getTime();
      > }
      > else {
      > url.search = d.getTime();
      > }
      > ...
      > d = null;[/color]

      Comment

      Working...