我想每 10 秒刷新一次通知计数。<span class="badge badge-danger badge-counter"> <?php getUnreadMsgCount($uid) ?></span>如何一次又一次地运行这个函数来获取我的通知计数这个函数存储在另一个页面中
1 回答
守着一只汪
TA贡献1872条经验 获得超3个赞
请尝试此代码
<div id="sample">Testing refresh every 5 seconds</div>
I would take a look at this below as well, although it may not be relevant in your case.
http://stackoverflow.com/questions/729921/settimeout-or-setinterval
Java 脚本
$(document).ready(
function() {
setInterval(function() {
var someval = Math.floor(Math.random() * 100);
$('#sample').text('Test' + someval);
}, 10000); //Delay here = 10 seconds
});
- 1 回答
- 0 关注
- 200 浏览
添加回答
举报
0/150
提交
取消