I use jQuery ajax to refresh a div every 2 seconds.
How to stop this refresh after 60 seconds (example, if user is inactive) ?
setInterval(function() {
$.ajax({
url: "feeds.php",
cache: false
}).done(function( html ) {
$('#feeds').replaceWith('<div id="feeds">'+html+'</div>');
});
}, 2000);
Thank you !
Assign the setInterval handle to a variable, which you will use to clear it after 60 seconds.