停止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 } });}
慕桂英3389331
临摹微笑
慕斯709654
相关分类