title: How to serialize forms and post using jQuery Ajax
body: <p>I'm trying to remove records from my DB......
  this is how my form looks like.........</p>
  
  <pre><code>@using (Html.BeginForm("RemoveDoctor", "Doctor", FormMethod.Post, new { @id = "form" }))
  {
      @Html.AntiForgeryToken()
      @Html.HiddenFor(model =&gt; model.Id)
      @Html.HiddenFor(model =&gt; model.Name)
      &lt;div class="form-actions no-color"&gt;
          &lt;input type="submit" value="Delete" class="btn btn-default" id="submit" /&gt; |
  
      &lt;/div&gt;
  }
  </code></pre>
  
  <p>I'm trying to get these records from the view and pass to my controller Action method............................. i'm trying to serialize this form and send it to that action method as following...................</p>
  
  <blockquote>
    <p>var jsonObj = $('#form').serialize();</p>
  </blockquote>
  
  <p>it serialize the form put my Ajax POST function wont run with that result......
  it just gives me an error!!!!................. I just need to pass that serialize value to my Action method............... This is how my Script looks like.....................</p>
  
  <pre><code>$('#submit').click(function () {
  
       var jsonObj = $('#form').serialize();
       alert(jsonObj);
  
       $.ajax({
             type: "POST",
             url: '../Doctor/RemoveDoctor',
             data: JSON.stringify({ "doctor": jsonObj }),
             success: function (data) {
                   alert(data.Message);
             },
             error: function () {
                    alert("Error!!!");
             }
        });
        return false;
  
  });
  </code></pre>
  
  <p>This is how my action method looks like....................</p>
  
  <pre><code>  public ActionResult RemoveDoctor(DoctorModel doctor)
    {
        bool confirmationResult = doctorManager.RemoveDoctor(doctor.Id);
        string displayMessage = string.Empty;
        if (confirmationResult == true)
             displayMessage = "You have successfully removed your record!!";
        else
             displayMessage = "Error!! Some Thing Went Wrong, Please Try Again!!";
  
        return Json(new { Message = displayMessage });
  
    }
  </code></pre>
  
  <p>I'm trying to send this 'displayMessage' to my jQuery code........ please some give me an idea how to solve this....... thanks!!!!!</p>