-2

I am calling a function for every 10 minutes this way

var int=self.setInterval(my_func, 600000);


function my_func(){

$.ajax({
         url: 'xxxxxxxx',
        success: function(response) {
    var data= JSON.parse(response);
    displayCustomerDetails(data);
        },
        error: function(e) {
            alert('Error full filling request');
        }
    }); 

}

How can i eliminate this delay when it is called for the first time ??

Pawan
  • 31,545
  • 102
  • 256
  • 434

1 Answers1

1

This should do:

my_func();    
var int=self.setInterval(my_func, 600000);

But 10 minutes for setInterval is pretty high. You may want to read about Ajax Push Engines (aka APE) - check this out.

Also, it looks like this question is similar: How to start setInterval loop immediately?

Community
  • 1
  • 1
bwitkowicz
  • 779
  • 6
  • 15