title: MVC 4 - Passing view model from view page to jQuery popup and back again
body: <p>I have a view that is bound to a view model. On that view I have a link that will popup a modal jquery dialog (using a partial view).</p>
  
  <p>What I need is to be able to pass the model to the model popup, update it, then pass it back to the view page.</p>
  
  <p>I have the modal popups loading with an action method in my controller (partial view). But struggling with passing the model to it.</p>
  
  <p>Any suggestions?</p>
  
  <p>Thanks so much in advance.</p>
  
  <p><strong>Script (on view page):</strong></p>
  
  <pre><code>// ZipLocator modal popup
  $(function () {
      $('#ZipLocatorDialog').dialog({
          autoOpen: false,
          width: 400,
          resizable: false,
          draggable: false,
          title: 'hi there',
          modal: true,
          show: { effect: 'blind' },
          open: function (event, ui) {
              // Load the ZipLocator action which will return the partial view _ZipLocator
              $(this).load('@Url.Action("ZipLocator", "Shop", New With { .area = "Shop"})');
          },
          buttons: {
              "Close": function () {
                  $(this).dialog('close');
              }
          }
      });
  
      $('#ZipLocatorOpener').click(function () {
          $('#ZipLocatorDialog').dialog('open');
      });
  });
  </code></pre>
  
  <p><strong>Controller Action for partial view:</strong></p>
  
  <pre><code>&lt;HttpGet()&gt;
      &lt;Compress()&gt;
      Public Function ZipLocator(model As ShopModel) As ActionResult
  
          Return PartialView("~/Areas/Shop/Views/Shared/Partials/Popups/_ZipLocator.vbhtml", model)
  
      End Function
  </code></pre>
  
  <p>As I said, the jQuery modal popup is working, I am just having a hard time passing my model to it.</p>
  
  <p>Step One is to pass the model TO the partial view (jQuery modal popup).
  Step Two is to pass the updated model back to the view after the dialog is dismissed.</p>