I’m probably tired for staring at this for too long,
maybe someone can clear this up for me:
//scripts in whispers are setup this way.
var something = function(){
setInterval(function1,1000);
setInterval(function2,1000);
blah .. blah...
}
//function2 is the same as this one
var function1 = function(){
ajax to do something on server
blah...
blah...
}
//button to stop things from running anymore
$('.stop').live('click',function(){
clearInterval(function1);
clearInterval(function2);
return false;
}
I should be able to stop function1 and/or 2 from running after
clicking the button yeah? For some reason – the ajax calls within the
two functions keep running and pinging the server.
clearIntervaldoes not take a function as a parameter, it takes an ID returned bysetInterval.