title: Form data not getting in action method MVC and jquery ajax
body: <p>I am showing a report in my application. User have facility to filter the report. So they input filter data and click 'Go' button. On 'Go' click I use jQuery to pass the whole form to the controller action. I want to read data from database, based on values of controls in form collection and pass the data back to the form and need to reload the report with the new data.</p>
  
  <p>I tried the following code.</p>
  
  <p><strong>.cshtml</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  $(document).ready(function () {
  
     $('#action_button').click(function () {
  
         //$('#trialReportForm').attr("action", '@Url.Action("ReportFilter", "MyController")');     
        //$('#trialReportForm').submit();    
  // While using above two commented lines instead of the below codes, I get the form collection correctly. BUt I cannot pass back the new data to the form. If this is the solution.. How can I pass the data back to form to reload the report?                         
  
  
  
         var formElements = $("#trialReportForm").serialize();
  
     //var data = { "parameter": $.toJSON(formElements) };
  
   var data = { "parameter": formElements };
  
  
  $.ajax({
      url: @Url.Action(ReportFilter", "MyController"),
      type: 'POST',
      data: data,
      dataType: 'json',
      success: OnSuccess,
      error: OnFailure
  });
  
  
      });
  
  
  function OnSuccess(result)
  {
  alert(result);
  }
  
  function OnFailure(result)
  {
  alert(result);
  }
  
  });
  </code></pre>
  
  <p></p>
  
  <p><strong>controller.cs</strong></p>
  
  <pre><code>[HttpPost]
      public JsonResult ReportFilter(string parameter)
      {
          return new DBConnect().GetFilterData(parameter);
       }
  </code></pre>
  
  <p>I tried below code too. But the parameter is empty</p>
  
  <pre><code>[HttpPost]
      public JsonResult ReportFilter(FormCollection parameter)
      {
          return new DBConnect().GetFilterData(parameter);
       }
  </code></pre>
  
  <p>I am getting the call in action method. But here the parameter is in some serialised form. But cannot deserialise it back. How can I deserialise it to form collection of some other form.?
  All I want is getting the value of input controls in the form.</p>
  
  <p>I tried the below two codes for deserialise. but none of them is working fine. Only getting exception.</p>
  
  <pre><code>1: var serializer = new JavaScriptSerializer();
       var jsonObject = serializer.Deserialize&lt;FormCollection&gt;(parameter);
  
  
   2: var request = JsonConvert.DeserializeObject&lt;FormCollection&gt;(parameter);
  </code></pre>