title: POST headers and body using Jquery AJAX
body: <p>I have to send a POST to a broker API including headers and a body:</p>
  
  <pre><code>Action  POST https://demo-api.ig.com/gateway/deal/session
  
  Header  
  Content-Type: application/json; charset=UTF-8
  Accept: application/json; charset=UTF-8
  X-IG-API-KEY: 5FA056D2706634F2B7C6FC66FE17517B
  
  Body    
  { 
  "identifier": "A12345", 
  "password": "112233" 
  } 
  </code></pre>
  
  <p>The API is here: <a href="https://labs.ig.com/rest-trading-api-guide" rel="nofollow">https://labs.ig.com/rest-trading-api-guide</a></p>
  
  <p>The problem is that every example on the internet sends the data as "data" like this:</p>
  
  <pre><code>jQuery.ajax(
  
  {
  
  url : 'https://demo-api.ig.com/gateway/deal/session',
  
  type: 'POST',
  
  dataType : "json",
  
  data: {identifier: "A12345", password: "112233"}
  
  });
  </code></pre>
  
  <p>I don't understand this, where is the header and the body? All examples look basically like this, I can't make heads or tail out of this. </p>