title: Jquery: Jquery not working in onunload event
body: <p>I am trying to send an ajax request in the onunload event of a page.
  I am using the $.post function of jquery, but when the event actually fires i get this error: "Microsoft JScript runtime error: '$' is undefined"</p>
  
  <p>Does this mean that the jquery library has been deferenced before the $.post function was called and so i will not longer be able to use Jquery?</p>
  
  <p>What should be my approach to solve this problem? I am doing this in an Asp.net 2.0 web application project. Following is the JS script on the page.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  
  function RemoveFromOnlineUsers()
  {
     debugger;
     if ($.browser.msie) 
     {
          alert("this is msie!");
     }
  
     $.post("../Main/FloatingWindowAjax.aspx", {REMOVEONLINEUSER : "&lt;%=Master.UserId.ToString() %&gt;" });       
  
      return false;
  }
          window.onunload = RemoveFromOnlineUsers;
  
  
      &lt;/script&gt;        
  </code></pre>