So, I have a web application with basic authentication.
When entering the system, the interval is set:
$("#login").click(function(e) { var interval = setInterval(function(){myFunction();}, 2000); });
Then, when I logged out, I need to stop the interval:
$("#logout").click(function(e) { if(typeof interval !== 'undefined') clearInterval(interval); });
But it doesnβt work, I think the way to check if the interval exists is wrong ... I can set the interval so that it works when I log in, but I need to stop / clear it when I click on my Logging out and not ...
PS. im using the interval to check "myFunction" automatically every 2 seconds, but maybe there is another way to do this without the interval? THX
source share