title: Post JSON to ASP.NET MVC 4 action from JQuery
body: <p>I'm working on an app that uses ASP.NET MVC 4. In some ways, I feel like I'm learning everything from scratch :). I'm told its worth it.</p>
  
  <p>I need to post some JSON to an Action in my controller. My action looks like the following:</p>
  
  <pre><code>[Authorize]
  public class MyController : Controller
  {
      [HttpPost]
      public ActionResult RemoveItem(string itemID)
      {
        // Do stuff...
        return Json(new { Status = 1, Message="Success" });
      }
  }
  </code></pre>
  
  <p>My JQuery code looks like the following:</p>
  
  <pre><code>function removeItem(id) {
    var json = { "itemID": id };
    $.ajax({
      type: "POST",
      url: "/myController/removeItem",
      contentType: "application/json; charset=utf-8",
      data: json,
      dataType: "json",
      success: removeItemCompleted,
      error: removeItemFailed
    });
  }
  
  function removeItemCompleted(results) {
  }
  
  function removeItemFailed(request, status, error) {
  }
  </code></pre>
  
  <p>In Fiddler, I notice a 500 error is returned.  The TITLE field in the response says: "Invalid JSON primitive: itemID".</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Thank you!</p>