title: jQuery post on window.unload(window or browser close)
body: <p>I need to send a post request when the user leaves the page in whichever way.  So far this is what i have, but it's not working:</p>
  
  <pre><code>$(window).unload(function(){        
   $.post("http://localhost/project/quizTime.php",{action:"updateTime",userID:userid,quizID:quizid,newTime:currentTime*1000,rand:Math.random()},function(time)
      {
      });
  });
  </code></pre>
  
  <p>the PHP code was tested by replacing window.unload with a click function. That works perfectly and updates everything as needed, which means the problem is with that $(window).unload trigger.</p>