Thanks, works!
On May 11, 4:06 pm, "Mike Alsup" <[EMAIL PROTECTED]> wrote: > On Sun, May 11, 2008 at 7:51 AM, Michael <[EMAIL PROTECTED]> wrote: > > > Hello, i just recently started using jQuery and I have to say it works > > great. > > However I cannot figure out how to constantly (every 5 seconds for > > example) refresh results by running the query script over and over. > > > in Firefox 2.0 this does work, however in Internet Explorer 6.0 (and I > > think in 7.0 as well) this fails to work. > > Even after hitting the refresh button on the IE browser the results do > > not update after the database of which > > the results are being taken out of has been updated with new data. > > > Basically what I do now to constantly refresh the results is: > > > setInterval(function(){ > > > $.get("test.php", function(html){ > > document.getElementById("testdiv").innerHTML = html; > > }); > > > },5000); > > > This works for Firefox, every 5 seconds the results from the > > 'test.php' will be output in the 'testdiv'. > > However when using IE 6, basically what happens is that the results > > just stay as they are, even after hitting > > the refresh button. Though, when i 'clear' my IE6 browser's cache, and > > THEN reload the page, then it does > > fetch the new results, but after that it doesn't update every 5 > > seconds. > > > Does anyone know how to fix this? > > > Thanks. > > IE will cache the response to ajax calls, so you need to change the > url every time. For example: > > setInterval(function(){ > var url = "test.php?" + new Date().getTime(); > $.get(url, function(html){ > $("$testdiv").html(html); > }); > > },5000); > > Alternatively, you could use the $.ajax function like so: > > setInterval(function(){ > $.ajax({ > url = "test.php", > cache: false, > success: function(html) { > $("$testdiv").html(html); > } > }); > > },5000);