Possible Duplicate:
Stop setInterval call in javascript
I use window.setInterval method for polling progress status. But need to disable this timer when it completed. How to disable timer?
      window.setInterval(function(){$.ajax({
          type: 'GET',
          url: 'imports',
          success: function(response){
            console.log(response);
            if(response['status'] != 'ok'){
              return;
            }
            $('.bar').css('width', response['progress'] + '%');
            if(response['step'] == 'completed') location.reload();
      }}, 'json');}, 1000);
 
     
     
     
     
     
    