title: clear one timeout, start another
body: <p>I'm auto-refreshing the content on a site using ajax/json. Using jkey, I trigger some posting to the document, and during this action I want to cancel the original setTimeout that's running ("reloading" at 2 mins) - and then trigger the entire function "content" again to start over after 5 secs. However, I can't seem to stop "reloading" properly, neither call "content" after the given seconds. Can anybody spot the error? </p>
  
  <pre><code> &lt;script&gt;
  $(function content(){
    function reloading(){
        $.ajax({                                      
        url: 'api.php',                          
        data: "",                      
        dataType: 'json',                    
        success: function(data)          
        {
          var id = data[0];              
            _id = id;
          var vname = data[1];           
          var message = data[2]; 
          var timestamp = data[3]; 
          var field1 = data[4]; 
          _field1 = field1;
          var val2 = parseInt(field1, 10) ;
          _val2 = val2;
          $('#output').hide().html( message ).fadeIn("slow");   
           $('#username').hide().html( vname +":" ).fadeIn("slow");
        setTimeout(reloading,120000);
   }
        });
    }
    reloading();
  }); 
  
    $(document).jkey('a',function() {
       $.post("update.php", { "id": _id} )
        $('#output').hide().html( "&lt;i&gt;thx" ).fadeIn("slow");
        $('#username').fadeOut("fast");
        $('#valg1').fadeOut("fast");
        $('#valg2').fadeOut("fast");
          clearTimeout(reloading);
         setTimeout(content,5000);
        });
  &lt;/script&gt;
  </code></pre>