我在 setIntervel() 中有一个函数,我想明确地停止执行这个函数。我该怎么做?这个函数是..
function autoLoad(chatboxtitle, msgId) {
setInterval(function() {
if (msgId != '') {
$.ajax({
type: "POST",
url: "../WebService1.asmx/GetMessagesDetail",
data: '{ "messageID": "' + msgId + '" }',
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
cache: false,
success: function(msg) {
$("#chatbox_" + chatboxtitle + ".chatboxcontent").empty();
$("#chatbox_" + chatboxtitle + ".chatboxcontent").append(msg.d);
$contentLoadTriggered = false;
},
error: function(x, e) {
alert("error");
}
});
}
}, 8000);
}