Question: UPDATE 2:

OK, looks like it runs the first time after a minute. How do I get it to run onload, then every minute after that?

**UPDATE 1:**

I've tried: `var interval = setInterval(get_reported_incidents, 60000);` but nothing happens. in `get_reported_incidents();` I just have an `alert("hello");`.

**ORIGINAL QUESTION:**

I want to run a function every minute:

```
get_reported_incidents();

```

But I am not sure which method is best for this task;

`settimeout` or `setinterval`

Answer: 
Strictly speaking, `setInterval()` was designed for repeating events and `setTimeout()` for one-shot events.

However you will tend to find that with `setTimeout()` time will "creep" gradually. I've not tried this at 1 minute intervals, but with a 1 second timer I found it happened quite a lot. A clock showing the current time (to the nearest millisecond) would show a steady increase in the millisecond value of "now".

See <http://jsfiddle.net/alnitak/LJCJU/> and tweak the interval to see what I mean!

So, for greatest accuracy, I do this:

```
var timerHandler = function() {
    var interval = 60000;
    // do some stuff
    ...

    var now = new Date();
    var delay = interval - (now % interval);
    setTimeout(timerHandler, delay); 
};

```

This is ideal if you want the timer events to be started *in sync* with the clock on your system, rather than at some unspecified time "roughly every minute".
obviously `setinterval` might be easier to maintain in your case

```
get_reported_incidents(); //first call
var interval = setInterval(get_reported_incidents, 60000);

```

vs

```
var interval;
function timeout (){
    get_reported_incidents();
    interval=setTimeout(timeout, 60000);
}
timeout();

```