views:

70

answers:

2

Hello ,

I'm working with a nice little Jquery that auto loads and refreshes a div every bla bla Seconds. Works perfectly on all browsers then I load up IE and bang what a surprise no luck! :(

Index.html

<script  type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#load').load('reload.php').fadeIn("slow");
}, 10000); // refresh every 10000 milliseconds

<body>
<div id="load"> </div>
</body>

</script>

reload.php

<?

echo time(); //just a timestamp example..

?>

Any ideas guys?

+2  A: 

Add a random value at the end of the url to avoid caching.. That should solve your problem. ex: $('#load').load('reload.php?_=' +Math.random()).fadeIn("slow");

Teja Kantamneni
wow nice! should have came here after the first hour trying to figure it out
Webby
or use jquery's $.ajax() function with cache: false, could be a bit overkill though. But I highly recommend that you send http headers in reload.php, which "deactivate" caching.
+2  A: 

Try closing your script tag before having your body tag.

<head>
<script  type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#load').load('reload.php').fadeIn("slow");
}, 10000); // refresh every 10000 milliseconds

</script>
</head>

<body>
<div id="load"> </div>
</body>
Catfish