自动刷新DIV使用JQuery [英] Auto Refresh DIV using JQuery
本文介绍了自动刷新DIV使用JQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的要求是自动刷新DIV每5秒
My requirement is to auto refresh a DIV every 5 seconds
我要刷新DIV内容
<div class="row-fluid">
<div class ="span2">
<label><spring:message code='total.registration' />:</label>
</div>
<div class = "span3">
${registrationStatusForm.totalRegis}
</div>
</div>
我还检查计算器上的一些问题,但不明白。 请注意,我用Spring Web MVC框架。 请建议。
I also checked some questions on stackoverflow but didn't understand. Please note that I'm using Spring Web MVC. Please suggest.
推荐答案
您需要创建一个新的视图和控制器被刷新所需的最小元素。
You need to create a new view and controller with minimum elements required to be refreshed.
我也面临同样的问题,我固定它通过编写一个新的控制器和视图股利被刷新,然后用setInterval的,实际上setTimeout的工作对我的要求,更好。
I also faced the same problem and I fixed it by writing a new controller and a view for the div to be refreshed and then used setInterval, actually setTimeout worked better for my requirement. :
setInterval(function(){
$('#your_div').load('newController');
}, time_interval);
这篇关于自动刷新DIV使用JQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文