停止设置间隔
2022-08-30 04:23:01
我想阻止处理程序中的此间隔重复运行。这有可能吗,如果是,如何实现?error
// example code
$(document).on('ready',function(){
setInterval(updateDiv,3000);
});
function updateDiv(){
$.ajax({
url: 'getContent.php',
success: function(data){
$('.square').html(data);
},
error: function(){
$.playSound('oneday.wav');
$('.square').html('<span style="color:red">Connection problems</span>');
// I want to stop it here
}
});
}