title: Update ViewModel with ajax return result
body: <p>I have the following Model</p>
  
  <pre><code>public class PersonViewModel {
      public Guid Id { get; set; }
      public string Firstname{ get; set; }
      public string Lastname { get; set; }
  }
  </code></pre>
  
  <p>My view looks something like this</p>
  
  <pre><code>@model Web.UI.PersonViewModel
  &lt;form class="form-horizontal" id="fuelux-wizard" method="post"&gt;
      @Html.Bootstrap().TextBoxFor(p =&gt; p.Firstname).Placeholder("First name")
      @Html.Bootstrap().TextBoxFor(p =&gt; p.Lastname).Placeholder("Last name")
      @Html.Bootstrap().Button().Class("btn btn-next").Text(Model.Id == Guid.Empty ? "Lets Start" : "Continue").HtmlAttributes(new { onclick = "CreatePerson();" }).AppendIcon("fa fa-arrow-right")
  
  &lt;/form&gt;
  </code></pre>
  
  <p>Here is the js function which gets called when button is clicked</p>
  
  <pre><code>function CreateProposal() {
  
      // DO Ajax call to create the person
      $.ajax({ url: "CreatePerson", type: "POST", data: $('form').serialize() })
        .done(function () {
  
            $('.wizard').wizard('next');
        })
        .fail(function () {
            alert("Unable to save.");
            $("#personModal").modal("hide");
        });
  }
  </code></pre>
  
  <p>In my controller I have a CreatePerson method too</p>
  
  <pre><code>[HttpPost]
  public JsonResult CreatePerson(PersonViewModel personViewModel )
  {            
      if(personViewModel .Id == Guid.Empty)
          personViewModel .Id = Guid.NewGuid();
       return Json(personViewModel );
  }
  </code></pre>
  
  <p>How do I update the ViewModel of the view? The idea is to create a person and this will assign a new Guid to the model. The text in the button will differ when there is a Guid assigned as to when there is not.</p>
  
  <p>Is there a way I can update the viewmodel with the returned ajax result?</p>
  
  <p>Can someone point me into the right direction?</p>