我试图在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);
});
答案 0 :(得分:2)
$(document).ready(function() {
var joeIncrement=1;
var interval = function(){
setTimeout(function() {
joeIncrement++;
$('#comment_counter').load('get_commentcount.php');
interval();
}, 15000*joeIncrement);
}
interval(joeIncrement)
});