Thursday, May 23, 2024
 Popular · Latest · Hot · Upcoming
121
rated 0 times [  122] [ 1]  / answers: 1 / hits: 15712  / 14 Years ago, fri, august 6, 2010, 12:00:00

I'm using JavaScript/Jquery to make a page auto-update with a value from a database, although it doesn't seem to update in Internet Explorer. It works fine in FireFox & Chrome. Can anyone explain what's wrong? It looks like IE is just displaying a cached version of the page. How can I prevent this happening? Thanks.



function updateComm() {  
var url=commandSys.php;
jQuery(#theElement).load(url);
}

setInterval(updateComm(), 1000);

More From » jquery

 Answers
6

Try disabling the cache with ajaxSetup



$.ajaxSetup ({
// Disable caching of AJAX responses */
cache: false
});

function updateComm() {
var url=commandSys.php;
jQuery(#theElement).load(url);
}

setInterval(updateComm, 1000);


Alternatively, you can manually just append a +new Date to url so it appends a query string to prevent caching.



Alternatively, disable caching on the server-side.


[#96000] Wednesday, August 4, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alorafrancisl

Total Points: 80
Total Questions: 96
Total Answers: 102

Location: Ukraine
Member since Sun, Dec 13, 2020
4 Years ago
;