settimeout executes multiple times

Viewed 7089

On button click I am calling Ajax function after every 3min

intervalId = setTimeout(function(){ searchSiteDetailViaAjax() }, 180000);

and on stop button I am stopping this

clearTimeout(intervalId);
intervalId = null;

initially for few time it works fine but then after executing the clearTimeout the timer calls the Ajax function again and again.

2 Answers
Related