I want to implement recursive calls when using setTimeout(). If the first parameter is not quoted, Firefox prompts setTimeout():uselesssetTimeout call (missing quotes around argument?) If quoted, Firefox will prompt that function is 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); //Writing this way will cause an error. The first parameter of the setTimeout() function must not be called with a simple function, but anonymous function! As for why, I don’t know} }); } refreshNum();