I am trying to use polling for a small check that is performed at an interval of 15 secs.
setInterval(function(){
$.ajax({ url: "aaa.com",
success: function(data){
showUpdate(data);
}, dataType: "text"});
}, 15000);
But this means that there is an initial delay of 15 secs, before the polling starts, which is not desired in my case.
How can i force the polling to start immediately?
Don’t look for smart solutions when simple ones do the job :
Alternatively, I’d generally prefer
Because there wouldn’t be a stack of calls in case of delayed response.