title: Keeping a jQuery .getJSON() connection open and waiting while in body of a page?
body: <p>I'm writing a basic push messaging system.  A small change has caused it to stop workingly properly.  Let me explain.  In my original version, I was able to put the code in the  of a document something like this:</p>
  
  <pre><code>&lt;head&gt;
    ...text/javascript"&gt;
    $(document).ready(function(){
      $(document).ajaxStop(check4Updates);
      check4Updates();
    });
  
    function check4Updates(){
      $.getJSON('%PATH%', callback);
    };
  ...
  &lt;/head&gt;
  </code></pre>
  
  <p>This worked nicely and would keep the connection open even if the server return null (which it would after say a 2 minute timeout).  It would just keep calling the getJSON function over and over indefinitely.  Happy Panda.  </p>
  
  <p>Now, I must put the code segment in between  tags.  Access to the $(document).ready() function pretty much won't work. </p>
  
  <pre><code>&lt;body&gt;
  ...
  check4Updates();
  $("body").ajaxStop(check4Updates);
  ...
  &lt;/body&gt;
  </code></pre>
  
  <p>This works... for a while.  Shortly thereafter, it will stop calling check4Updates and get into an infinite loop and use 100% processor time.  </p>
  
  <p>I'm trying to get it so that check4Updates is repeatedly called until the page is closed.  If anyone has any insights as to why my simple change is no longer functioning as expected, PLEASE let me know.  Thank you for taking the time to read and help me out.  </p>
  
  <p>Best Regards, 
  Van Nguyen</p>