title: How to set custom xhr header with PJAX?
body: <p>I'm trying to set a custom header with pJax so I can render things on the server side. Per the <a href="https://github.com/defunkt/jquery-pjax" rel="nofollow">pjax docs</a>, I can use <code>pjax:beforeSend</code> to set xhr headers.</p>
  
  <p>Getting the following error:</p>
  
  <pre><code>typeerror xhr.setrequestheader is not a function
  </code></pre>
  
  <p>The code i've tried:</p>
  
  <pre><code>$(document).on('pjax:beforeSend', function(xhr) { 
      if ($(event.target).data('rendertimeline') !== undefined) {
          xhr.setRequestHeader('X-RENDERTIMELINE', 'true');
      }
  });
  </code></pre>
  
  <p>basically, i'm adding a data attribute to certain links and would link to check for that attribute. if its there, send a custom HTTP header along side the standard HTTP_X_PJAX header. Seemed fairly simple but i'm coming up short somewhere.</p>