title: Pause and resume ajax repeated request
body: <p>In order to code posted by Wiktor (<a href="https://stackoverflow.com/a/43338063/7666076">https://stackoverflow.com/a/43338063/7666076</a>) how to pause and resume sending ajax requestes after click on some button (two different buttons like 'pause' and 'play').</p>
  
  <p>Also how to break the current ajax request immediatelly after click on "pause" button. I don't want to wait for new data which will be fetched by ajax query.</p>
  
  <p>Here is my adapted code:</p>
  
  <pre><code>function RefreshData()
  {
      console.log('Sending AJAX request...');
      $.ajax({
          type: "GET",
          url: "getAjaxRequest.php?"+device+"&amp;callback=?",
          dataType: "jsonp"
      }).done(function(dataJSON) {
          adaptJsonData(dataJSON);
          console.log('success');
      }).fail(function() {
          console.log('error');
      }).always(function() {
          intervalTime = 100;
          console.log('Waiting '+intervalTime+' miliseconds...');
          setTimeout(RefreshData, intervalTime);
      });
  
      return true;
  }
  
  function adaptJsonData(dataJSON) {
      # ... some logic with dataJSON object
  }
  </code></pre>