停止setInterval我想在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
}
});}
停止setInterval
至尊寶的傳說
2019-08-13 14:08:13
