我正在尝试增加setInterval或setTimout的超时。但是,我的全局无法正常工作。我不熟悉javascript。请帮忙!
//What I'm trying to do:
$(document).ready(function() {
var joeIncrement=1;
setInterval(function() {
joeIncrement++;
$('#comment_counter').load('get_commentcount.php');
}, 15000*joeIncrement);
});
最佳答案
$(document).ready(function() {
var joeIncrement=1;
var interval = function(){
setTimeout(function() {
joeIncrement++;
$('#comment_counter').load('get_commentcount.php');
interval();
}, 15000*joeIncrement);
}
interval(joeIncrement)
});