如何在指定时间后重新加载网页的一部分? [英] How to reload, a part of a webpage after a given time?
本文介绍了如何在指定时间后重新加载网页的一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以,我会在给定的时间内连续读取数据库,并相应地向用户显示消息。
但我想要的信息,只能在页面的一部分更新(可以说是DIV)。
任何帮助,将不胜感激!
谢谢!
解决方案
使用 setInterval()
和 jQuery.load()
以下示例将刷新带有ID结果的div,每5秒另一个文件的内容:
setInterval(function(){
$('#result')。 load('test.html');
},5000);
What i want to do is, to show a message based on certain condition. So, i will read the database after a given time continuously, and accordingly, show the message to the user. But i want the message, to be updated only on a part of the page(lets say a DIV).
Any help would be appreciated ! Thanks !
解决方案
This is possible using setInterval()
and jQuery.load()
The below example will refresh a div with ID result with the content of another file every 5 seconds:
setInterval(function(){
$('#result').load('test.html');
}, 5000);
这篇关于如何在指定时间后重新加载网页的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文