title: clearInterval inside setInterval, unable to break loop, with jquery and .post()
body: <p>I'm trying to call clearInterval inside setInterval function, which is doing some ajax fetching, without any luck.</p>
  
  <pre><code>var nre = setInterval('checkit()',5000);
  $(function() {
      checkit = function(){
          $.post("check.php", { login: "&lt;?php echo $_SESSION['login'];?&gt;" }, function( data ) {
              if (data == 1) {
                  $('#debug').html(data);
                  window.clearInterval(nre);
              }
  
          });
      }
  });
  </code></pre>
  
  <p>The point is, that the loop wont break, although recieves positive data to do so.</p>
  
  <p>I've read that async action of setInterval function might be the issue here. Is there a better way to solve it?</p>