Is there a way to stop the .complete call from firing? done and fail are not good enough, since there is recursion in the complete part. (i want it to do it again even if it fails)
request.complete(function(){
myrefresh = setTimeout(function(){updateMenu(ID);}, 5000);
});
is the complete method of my ajax call that runs every 5 sec.
Finally, when this updating is complete, I’ll have a reponse from the request.done that will give me a flag to conditionalize on.
ie, i want to do something like this:
if(flag=0) { request.complete(function(){
myrefresh = setTimeout(function(){updateMenu(ID);}, 5000);
});
} else { clearInterval(myrefresh) }
but in the construct of a big
var request = $.ajax({
url: etc
set up.
Any ideas?
on how to set this up? I can’t seem to get the .done return (text) var to work in the .complete area.
I think you’re looking for setInterval() and clearInterval(). They’re native JavaScript functions that allow you to repeatedly execute a function at a given time interval.