title: Send X-CSRF Token to a Django server using XHTTP Request or jQuery Ajax
body: <p>I've been trying to make a POST to my Django application via XHTTP Request and jQuery with no correct result at all.</p>
  
  <p>The fact is that the Django app is on one of my subdomains, and the web app is in another, not being part of the Django app, just only a separated app.</p>
  
  <p>I've been reading the docs, but none of this works.</p>
  
  <p>All of my subdomains are in the ALLOWED HOSTS list and in the CORS ORIGIN WHITELIST, and the petition works correctly with GET, but POST returns me a Forbidden 403 error telling CSRF Cookie not found.</p>
  
  <p>This is the code of my petition.</p>
  
  <pre><code>var petition = new XMLHttpRequest();
  petition.open('POST','http://localhost:8000/login/',true);
  petition.setRequestHeader("X-CSRFToken",sessionStorage["csrf_token"]);
  petition.send()
  </code></pre>
  
  <p>I already have stored the CSRF cookie in the session storage with this function.</p>
  
  <pre><code>function storeCSRFToken(){
      var token;
      $.ajax({
          url : 'http://localhost:8000/token',
          type: "GET",
          dataType : "json",
          success: function( data ){
              token = data.csrf_token;
              sessionStorage['csrf_token'] = token;
          }
      });
  }
  </code></pre>
  
  <p>Any clue of what is going wrong?</p>