tags:

views:

71

answers:

2

I've created a stock ticker function and need to call it every 2 minutes.

I've succeeded in doing this with the javascript setInterval function, but the problem is on the first call it waits 2 minutes before calling the function, whereas I want the first load to be called right away.

function CallFunction() {
  setInterval("GetFeed()", 2000);
}
+4  A: 
function CallFunction() {
        GetFeed();
        setInterval("GetFeed()", 2000);
    }
TriLLi
my 2 cents `setInterval(GetFeed, 2000);`
Victor
+2  A: 
function CallFunction() {
  GetFeed();
  return setInterval(GetFeed, 2 * 60 * 1000);
}

var id = CallFunction();
aekeus