Shoutbox

[Resolved] AJAX cache problem - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [Resolved] AJAX cache problem (/showthread.php?tid=64809)

[Resolved] AJAX cache problem by Huhu_Manix on 08-12-2006 at 01:53 AM

Hi,

My problem is when I open 2 time the same URL, the script return the same response but the web page has been change.

code:
function getScore(){
    ajax = new ActiveXObject("Microsoft.XMLHTTP");
    ajax.open("GET",url, true);
    ajax.onreadystatechange = getReturn;
    ajax.send(null);
}


Someone know how I can refresh the URL ?

Thx


I found this but i don't try yet :
code:
function getScore(){
    ajax = new ActiveXObject("Microsoft.XMLHTTP");
    ajax.open("GET",url, true);
    ajax.onreadystatechange = getReturn;
    ajax.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
    ajax.send(null);
}

RE: [Resolved] AJAX cache problem by matty on 08-12-2006 at 02:52 AM

Why not just use the DeleteUrlCacheEntryW API?

code:
function ClearCache(sUrl){
    return Interop.Call('wininet.dll', 'DeleteUrlCacheEntryW', sUrl);
}

RE: [Resolved] AJAX cache problem by Huhu_Manix on 08-12-2006 at 12:14 PM

Thanks i'll try if no-cache doesn't works.


RE: [Resolved] AJAX cache problem by alexp2_ad on 08-12-2006 at 01:12 PM

The common way is usually to add a random number to the url...

Like...

url+='?refresh='+Math.Random;


RE: [Resolved] AJAX cache problem by Huhu_Manix on 08-13-2006 at 07:02 PM

I tried with no-cache and the DeleteUrlCacheEntryW, that's works ! (y)