I want to call the function interpret_st()
when i click run
and stop interpret_st
current execution when i click stop
. Is this the right way to do it?
var interpret_st;
$('#run').click(function(e) {
interpret_st = setTimeout(interpret(), 1);
});
$('#stop').click(function(e) {
clearTimeout(interpret_st);
});
UPDATE what i really wanted to do is when i clicked stop, i want to go out the function interpret