Issue with cache with XMLHttpRequest

O

OraWiz

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.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send(null);
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send();
}
}
}


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

Njoy....
 
V

VK

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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top