title: HTTP headers not being set while in setInterval
body: <p>I'm using jQuery 2.2.4 and I have the following code:</p>
  
  <pre><code>var sessionProgressInterval = sessionProgress();
  function sessionProgress() {
      return window.setInterval( function() {
  
    $.ajax({
      type: "POST",
      url: "/report/session",
      data: {_token: _token},
      beforeSend : function(xhr) {
          xhr.setRequestHeader("X-CSRF-TOKEN", "Foooo");
      },
      headers: {
          'X-CSRF-TOKEN': "Asdasd"
      }
  })
      .done(function(response) { })
      .fail(function(jqXHR, textStatus, errorThrown) {
          console.log( "error Sending stats:" + errorThrown );
          clearInterval(sessionProgressInterval);
      }).always(function(){ });
    }, 10000 );
  };
  </code></pre>
  
  <p>I've tried setting custom headers in both ways (together and each alone) and In the network tab they don't get sent.</p>
  
  <p>If I try this code outside the setInterval method,meaning I just send an ajax, it works.</p>
  
  <p>Any idea why? Everything I found regarding the topic one of the two seemed to work to people.</p>