title: How to send a dynamic list of objects to controller in MVC using jQuery and Ajax
body: <p>I am populating a form dynamically with objects, allowing a new field to be edited, and then trying to submit the form to another list of a different object type. </p>
  
  <p>I am currently using an Ajax form to do this, but the <code>&lt;label for=&gt;</code> attributes are not being sent to the partial view result along with the other attributes. </p>
  
  <p>My controller partial view result is as follows: </p>
  
  <pre><code>[HttpPost]
  public PartialViewResult AddToOrder(IList&lt;OrderItemModel&gt; form_list)
  { 
      // do something
  }
  </code></pre>
  
  <p>The Ajax form in my view is as follows: </p>
  
  <pre><code>@using (Ajax.BeginForm("AddToOrder", "Order", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "result" }))
  {
     for (int i = 0; i &lt; Model.Count; i++)
     {
      &lt;tr&gt;
         &lt;input type="hidden" name="form_list[@i].item_id" value="@Model[i].id" /&gt;
         &lt;td&gt;&lt;label for="form_list[@i].description"&gt;@Model[i].description&lt;/label&gt;&lt;/td&gt;
         &lt;td&gt;&lt;label for="form_list[@i].price"&gt;@Model[i].price&lt;/label&gt;&lt;/td&gt;
         &lt;td&gt;&lt;input type="text" name="form_list[@i].quantity"  value="0" /&gt;&lt;/td&gt; 
      &lt;/tr&gt;
     }
  
     &lt;td&gt;&lt;input type="submit" value="Add to order"/&gt;&lt;/td&gt;
  }
  </code></pre>
  
  <p>If I duplicate my labels as <code>&lt;input type="hidden"&gt;</code> attributes, all the fields I need are sent to the partial view result, but is there a better way to do this maybe using jQuery instead of an Ajax form?</p>