自动重装div容器 [英] automatic reload of div container

查看:85
本文介绍了自动重装div容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

而不是整个页面刷新一定时间后,我只是想要一个特定的div容器重新加载/刷新。有没有办法做到这一点?

instead of a whole page refresh after a certain time, i'd just like a specific div container to reload/refresh. is there any way to do this?

<div id="wrapper">
<div id="quoteContainer"></div>
</div>


推荐答案

您可以使用jQuery和Google ajax api

You can get the effect you desire with jQuery and Googles ajax api

<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_latest_scores').load('latest_scores.html');
}, 10000); // refresh every 10000 milliseconds
</script>
<body>
<div id="load_latest_scores"> </div>
</body>

这篇关于自动重装div容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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