我有一个问题,我不能只在3秒后刷新一个div。
$(document).ready(function(){
setInterval(function() {
$("#online-users-random").html();
}, 5000);
});
<div id="online-users" class="online-users">
<span>Online: </span><span><?php echo rand(1,1000); ?></span>
</div>
我想刷新div我也尝试了.load etc... but its not option that i need
至少我找到了解决方案......
function auto_load(){
$.ajax({
url: "LINK",
cache: false,
success: function(data){
$("#online-users-random").html(data);
}
});
}
$(document).ready(function(){
auto_load();
});
setInterval(auto_load,5000);