如何使用AJAX在我的网站上刷新结果?
<div id="Results">
// Mysql info to show a list of <li>
</div>
我想每10分钟更新一次div。
答案 0 :(得分:5)
将您的AJAX代码放在setInterval
javascript函数
setInterval("getListItems()", 600000);
答案 1 :(得分:0)
我会使用带有递归函数的jQuery的load()元素。
示例(我没有测试):
function reload(url,miliseconds) {
setTimeout(function() {
$('#container').text('');
$('#containter').load(url);
return reload(url,miliseconds);
},miliseconds);
}
$(document).ready(function(){
reload('http://www.website.com/dynamic_content.php',600000);
});