title: jQuery: inactivity refresh/logout
body: <p>I am using the below jQuery to refresh my datatable.  I know there is a better way to do this, but for the time being, this is what is working for me:</p>
  
  <pre><code> var idleTime = 0;
   var idleInterval = setInterval(funcion(){
     idleTime = idleTime + 1;
     if (idleTime &gt; 1)
     {
       $('#example1').DataTable().state.clear();
       window.location.reload();
     }
   }, 60000);
  
   $(this).mousemove(function(e){
     idleTime = 0;
   });
   $(this).keypress(function(e){
     idleTime = 0;
   });
  </code></pre>
  
  <p>Using the above code, after about 1 minute, the page will clear the datatable and reload the page.</p>
  
  <p>Is there something that I can add to the code that will look at how many times it has refreshed due to inactivity?  And then after 120 refreshes, log the user out.</p>
  
  <p>I am not sure if this can be done being that the page keeps refreshing.</p>