SetTimeout of recursive call without quotes error
- 2020-03-30 03:54:29
- OfStack
Using setTimeout() to make recursive calls, if the first argument is not quoted, firefox prompts setTimeout():uselesssetTimeout call (missing quotes around arguments ?) If it's in quotes, firefox will prompt that function undefined
function refreshNum() {
$.ajax({
type: "POST",
url: "ajax/RefreshNum.ashx",
async: false,
data: {},
success: function (data) {
varnumArry = data.split(',');
$.each($(".rush_left"), function (n) {
$(this).children().eq(0).html(numArry[n]);
});
setTimeout(function () { refreshNum(); }, 3000);
//setTimeout("refreshNum",3000); // It's going to make a mistake ,setTimeout() The first argument to a function must not be a simple function call, but an anonymous function! Why not
}
});
}
refreshNum();