title: Why Javascript POST Request to ASP.NET controller action getting NULL parameter?
body: <p>The parameters of my ASP .NET controller method stays null when I send a <code>XmlHttpRequets</code> from my JavaScript file. The JavaScript debugger shows that the request sends successfully. Why is It not working?</p>
  
  <p><strong>JavaScript function:</strong></p>
  
  <pre><code>function BuyBook(title) {
      var xmlHttp = new XMLHttpRequest();
      xmlHttp.open("POST", "home/BuyBook", true);
      xmlHttp.setRequestHeader("Content-Type", "multipart/form-data");
      var order = { BookTitle: title, Quantity: document.getElementById("quantity").value };
      xmlHttp.send(JSON.stringify({ order: order }));
      console.log(xmlHttp.responseText);
  }
  </code></pre>
  
  <p><strong>Controller method:</strong></p>
  
  <pre><code>[HttpPost]
          public IActionResult BuyBook(Models.Order order)
          { .... }
  </code></pre>
  
  <p><strong>Models.Order class:</strong></p>
  
  <pre><code>public class Order
      {
          [Required]
          public string BookTitle { get; set; }
  
          [Range(1,100)]
          public int Quantity { get; set; }
      }
  </code></pre>