title: ASP.NET MVC3 form collection is 0 during jQuery ajax post
body: <p>I am working on an ASP.NET MVC3 application.</p>
  <p>I am attempting to POST to a method that returns a bunch of data using the <a href="http://api.jquery.com/jQuery.ajax/" rel="nofollow noreferrer">jQuery.ajax api</a>; however whenever the request is handled by the server my form collection's keys count is 0 and so my view model isn't populated which is a problem.</p>
  <p>I am applying applying the ajax to my form's submit like this:</p>
  <pre><code> $(document).on(&quot;submit&quot;, &quot;form&quot;, function (event) {
      event.preventDefault();
      var form = $(this);
      $.ajax({
          type: &quot;POST&quot;,
          url: this.action,
          data: form.serialize(),
          contentType: &quot;application/html; charset=utf-8&quot;,
          dataType: &quot;html&quot;,
          success: function (result) {
              var d = new Date();
              var str = d.toString() + result;
              $('#dynamicContent').html(str);
          }
      });
  
  });
  </code></pre>
  <p>My form is created like this:</p>
  <pre><code>  @Using Html.BeginForm(&quot;GetContent&quot;, &quot;TheController&quot;, FormMethod.Post, New With {.id = &quot;GetContentForm&quot;})
              @Html.DropDownListFor(Function(model) model.SelectedTypeID, New SelectList(Html.NullListItemOptionList(Model.TypeOptions.ToList, &quot;Please Choose&quot;), &quot;ID&quot;, &quot;Name&quot;, Model.SelectedTypeID), New With {.onchange = &quot; $(this).parents('form').submit();&quot;})
              @&lt;input type=&quot;submit&quot; value=&quot;Refresh&quot; style=&quot;cursor: pointer&quot; /&gt;
    End Using
    &lt;div id=&quot;dynamicContent&quot;&gt;
    &lt;/div&gt;
  </code></pre>
  <p>My controller method is:</p>
  <pre><code> &lt;HttpPost()&gt;
      Function GetContent(ByVal collection As FormCollection) As PartialViewResult
  
          Dim itemsVM As New ItemsViewModel
          TryUpdateModel(itemsVM, collection)
          Return PartialView(&quot;PartialItems&quot;, itemsVM)
      End Function
  </code></pre>
  <p>It's almost as if the serialization of the form is not working but I don't know how to fix this. I would really appreciate some insight into why this isn't working.</p>
  <p>Thank you.</p>