This is a scope issue, declare the var inth
outside the function as a global variable. and use inth = setInterval(...)
in the startAjax
function.
As you said in your question, your handler is global. But the variable itself is not, so it can't be accessed outside the scope of the function.