title: Ajax request with list of javascript objects failing
body: <p>This question is asked a lot, but none of the answers worked for me. I'm trying to send a list of objects to a controller in ASP MVC 5. I'm <code>JOSN.stringify</code>'ing the list, and trying to receive it into a list.</p>
  
  <p>I sure hope it's not some stupid typo I'm missing...</p>
  
  <p><em>Well</em> I did just find a typo (funny how writing things down helps), but it isn't the problem. The ajax is calling "Sale" but the controller is "Sales". I fixed it, but still same problem. (added picture at end).</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I changed the ajax to:</p>
  
  <pre><code>$('#complete-sale').on('click', function ()
  {
      alert("in complete sale");
      var itemsInCart = JSON.stringify(shoppingCart.getItemsInCart());
      alert("itemsInCart: " + itemsInCart);
      $.ajax({
          type: "GET",
          url: "/Sales/completeSale", // the method we are calling
          contentType: "application/json; charset=utf-8",
          data: { 'itemsInCart': itemsInCart },
          dataType: "json",
          success: function (result) {
              alert("sale complete succeeded" + result[0]);
              addItemToCart(result[0]);
          },
          error: function (result) {
              alert("failed complete sale request " + result[0]);
          }
      });
  });
  </code></pre>
  
  <p>The request URL shown in developer tools is now: </p>
  
  <pre><code>http://localhost:52459/Sales/completeSale?itemsInCart=[{"ItemId":1,"Quantity":"1","Price":3.5}]
  </code></pre>
  
  <p>Which seems like it should be right. I also changed the controller return to <code>return View("hello")</code> so something actually comes back.</p>
  
  <p>Model:</p>
  
  <pre><code>public class ItemInCart
  {
      [Key]
      public int ItemId { get; set; }
      public virtual Variety variety { get; set; }
  
      public int Quantity { get; set; }
      public virtual InventoryItem inventoryItem { get; set; }
  
      public double Price { get; set; }
      public virtual Variety price { get; set; }
  
  }
  </code></pre>
  
  <p>Controller (<code>Sales.cs</code>):</p>
  
  <pre><code>    [HttpGet]
      public ActionResult completeSale(List&lt;ItemInCart&gt; itemsInCart)
      {
          return View();
      }
  </code></pre>
  
  <p>Ajax:</p>
  
  <pre><code>$('#complete-sale').on('click', function ()
  {
      alert("in complete sale");
      itemsInCart = shoppingCart.getItemsInCart();
      stringifiedItemsInCart = JSON.stringify({ 'itemsInCart': itemsInCart});
      alert("stringified: " + stringifiedItemsInCart);
      $.ajax({
          type: "GET",
          url: "/SalescompleteSale", // the method we are calling
          contentType: "application/json; charset=utf-8",
          data: stringifiedItemsInCart,
          dataType: "json",
          success: function (result) {
              alert("sale complete succeeded" + result[0]);
              addItemToCart(result[0]);
          },
          error: function (result) {
              alert("failded complete sale request " + result[0]);
          }
      });
  });
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/AV4AJ.png" alt="alert request failed"></p>
  
  <p><img src="https://i.stack.imgur.com/HZ4xe.png" alt="ajax post stringified"></p>
  
  <p><img src="https://i.stack.imgur.com/f09At.png" alt="developer tools 1"></p>
  
  <p><img src="https://i.stack.imgur.com/p0aGv.png" alt="developer tools 2"></p>
  
  <p><img src="https://i.stack.imgur.com/qwlB9.png" alt="enter image description here"></p>