title: Auto-repeating AJAX function doesn't work
body: <p>I'm looking to repeat this function every five seconds:</p>
  
  <pre><code>  function check_votes(id) {  
          $.ajax({
              type: 'POST',
              url: 'check_votes.php',
              data: 'checkvotes='+id,
              timeout: 0,
            success: function(data) {
            window.setTimeout(check_votes(id), 5000);
              $('.vote_count_'+id).show();
              $('.vote_count_'+id).html("("+data+" votes so far)");
            }
          });
          return false;
    };
  </code></pre>
  
  <p>Why doesn't this line do the trick:</p>
  
  <pre><code> window.setTimeout(check_votes(id), 5000);
  </code></pre>
  
  <p>In fact, it breaks it, so I need to use the following line:</p>
  
  <pre><code> window.setTimeout(check_votes, 5000);
  </code></pre>
  
  <p>But that allows for the script to run initially, but I get no auto-repeating.</p>