title: MVC ajax calling controller method
body: <p>I am trying to use ajax to call a controller method and i am getting a internal server error.</p>
  
  <p>The jquery looks like this:</p>
  
  <pre><code>function user(id) {
      alert(id+" "+$("#comment").val());
      var param = {
          userId : id,
          comments : $("#comment").val()
      };
  
      $.ajax({
          url: "/Admin/User",
          contentType: "application/x-www-form-urlencoded",
          type: "POST",
          datatype: "json",
          data: param,
          error: function (xmlHttpRequest, errorText, thrownError) {
              alert(xmlHttpRequest+"|"+errorText+"|"+thrownError);
          },
          success: function (data) {
              if (data != null) {
                  alert("success");
              }
          }
      }); 
  }
  </code></pre>
  
  <p>the controller looks like this:</p>
  
  <pre><code>[HttpPost]
      public ActionResult User(int id, string comment)
      {
  
          var user = UserModel.GetPerson(id);
  
          user.IsDeleted = true;
  
          UserModel.UpdatePerson(user);
  
          return RedirectToAction("ManageUsers");
      }
  </code></pre>
  
  <p>It looks like the code isnt even getting to the controller. the 1st alert in <code>user(id)</code> is being triggered.  Does anyone see whats going on here?</p>