How can I execute this function immediately, then start the setInterval timer?
Here is my js.
$(document).ready(function(){
var callAjax = function(){
$.ajax({
method:'get',
url:'apinvs.php',
dataType:'html',
success:function(data){
$("#main").html(data); }
});
}
setInterval(callAjax,2500);
});
It's executing the function after 2.5 seconds. It leaves the div blank until 2.5 seconds pass, which is what I don't want to happen. :(
I found a Stackoverflow question here but I'm not sure how to apply it with my code (it's using document ready). Thanks for any assistance.