title: JQuery AJAX Header Authorization POST
body: <p>I have to send <strong>XML</strong> to the server with <strong>Authorization header</strong> and it <strong>MUST</strong> be <strong>POST</strong>.</p>
  
  <p>Now I have two options.</p>
  
  <ol>
  <li><p>When I use dataType = 'jsonp' it always becomes GET instead of POST. Also my data is must be XML.</p>
  
  <pre><code>        var request = {};
          request.type = 'POST';
          request.contentType = 'application/jsonp; charset=utf-8';
          request.dataType = 'jsonp';
          request.data = JSON.stringify(this.data);
          request.url = this.url;
          request.beforeSend = function (xhr) {
              xhr.setRequestHeader("Authorization", "Basic ");
          };
  
          request.processData = false;
          $.ajax(request);
  </code></pre></li>
  <li><p>But without dataType = 'jsonp' I don't have Authentication header at all. The following code works only for Chrome.</p>
  
  <pre><code>    var request = {};
      request.type = 'POST';
      request.contentType = 'text/xml';
      request.dataType = 'xml';
      request.data = this.data;
      request.url = this.url;
      request.beforeSend = function (xhr) {
          xhr.setRequestHeader("Authorization", "Basic ");
      };
  
      request.processData = false;
      $.ajax(request);
  </code></pre></li>
  </ol>
  
  <p>Yes, I know that there are a lot of similar questions on StackOverflow and I've read dozens of them but still don't find the right answer.</p>