var xhr=false; setTimeout(function(){ if(xhr) xhr.abort(); location.reload(); },10000); setInterval(function(){ xhr=$.post('/'); },1000);