使用jQuery每10秒自动加载和刷新Div [英] Auto Load and Refresh Div every 10 Seconds with jQuery

查看:109
本文介绍了使用jQuery每10秒自动加载和刷新Div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个漂亮的小Jquery,自动加载并刷新每个bla bla秒的div。
在所有浏览器上都能完美运行然后我加载IE并发出惊喜没有运气! :(

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

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

reload.php

<?

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

?>

任何想法的家伙?

推荐答案

在网址末尾添加一个随机值以避免缓存..这应该可以解决您的问题。例如: $('#load')。load('reload.php?_ ='+ Math.random())。fadeIn(slow);

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");

这篇关于使用jQuery每10秒自动加载和刷新Div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆