title: Javascript - run a php file every X seconds
body: <p>I would like to be able to record the amount of seconds a person is on my site in the simplest way possible. Don't need google analytics or any other 3rd party sources.</p>
  
  <p>The php script would create a connection to mysql and update the relevant values, </p>
  
  <p>I found some script online, but it doesn't seem to be working:</p>
  
  <hr>
  
  <pre><code>&lt;script  src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"&gt; &lt;/script&gt;
  &lt;script&gt;
     $(document).ready(function()
     {
         var refreshId = setInterval(function()
            $.load('timeonpage.php?wzx=&lt;?php echo $t; ?&gt;&amp;ip=&lt;?php echo $ip; ?&gt;');
         }, 5000);
     );
  &lt;/script&gt;
  </code></pre>
  
  <p>Thanks for any help!</p>