title: How to use Ajax in MVC 3?
body: <p>I have a form that I'd like to submit through Ajax. This form is stored in a partial view - so the entire partial view represents a single form. </p>
  
  <p>I generate ten of these forms with a foreach loop:</p>
  
  <pre><code> @foreach (Product p in Model.Products)
   {                     
      @Html.Partial("_EditProduct", p)                    
   }
  </code></pre>
  
  <p>This works fine.</p>
  
  <p>In the _EditProduct partial view I have:</p>
  
  <pre><code>@using (Ajax.BeginForm("Update", "Product", new AjaxOptions { UpdateTargetId = "updateStatus" })) {
       &lt;span id="updateStatus"&gt;Update will go here&lt;/span&gt; }
  
       // Product fields
  
          &lt;div&gt;                
               &lt;input type="submit" value="Update" class="btn"/&gt;
          &lt;/div&gt;
      }
  </code></pre>
  
  <p>Clicking on a submit button posts to a controller:</p>
  
  <pre><code>[HttpPost]
  public JsonResult Update(int id, FormCollection collection)
  {
     ProductService pService = new ProductService();
     Product p =pService.Find(id);
  
     UpdateModel(p);
     return Json(p);            
  }
  </code></pre>
  
  <p>This updates the product, but return crashes due to serialization error.</p>
  
  <p>The main problem is that I struggle to find a good resource on MVC 3, especially the Ajax part. Tutorials and blogs seem to do everything in a very different way. Ideally I'd like to use as much of .NET and MVC 3 functionality as possible, rather than writing loads of jQuery/JavaScript.</p>
  
  <p>Thank you</p>
  
  <p><strong>Edit:</strong> Just to add, I'd like to stay far away from MS Ajax Control Toolkit</p>