title: Post from IFRAME and Return to Partial View in Parent
body: <p>My apologies if this is a dupe, but I haven't been able to find an exact solution to my problem.</p>
  
  <p>Goal:
  Upload a file, do work, return results. Easy right?</p>
  
  <p>Problem:
  I've been working on this for a few days without any luck. I've tried XmlHttpRequest, but due to the browser limits (can't get away with forcing end-users and clients to use IE10 or higher) that doesn't seem to be an option.</p>
  
  <p>What I've spent most of my time on is uploading via iframe. I've gotten the upload piece working fine. What I need to happen is after doing work with the file, results should be returned back to the parent window and a partial view.</p>
  
  <pre><code>----------------------Index--------------------
  Partial View Data Entry----Partial View Results
  -----Upload iframe----------Results from file--
  </code></pre>
  
  <p>Here's what I have for code:  </p>
  
  <p>DataEntry.cshtml</p>
  
  <pre><code>&lt;div&gt;
      ...textboxes, radiobuttons, etc...
      &lt;iframe id="uploadFrame" class="seamless" frameborder="0" src='@Url.Action("UploadFile")'&gt;&lt;/iframe&gt;
  &lt;/div&gt;  
  </code></pre>
  
  <p>UploadFile.cshtml</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function () {
          $("#uploadFile").click(function () {
              $("#field1").val(window.parent.document.getElementById("field1").value);
              $("#field2").val(window.parent.document.getElementById("field2").value);
              ...other fields...
  
              $("#fileForm").submit();
          });
  
          $("#file").change(function () {
              if ($("#file").val() != "") {
                  $("#uploadFile").removeAttr("disabled");
              }
              else {
                  $("#uploadFile").attr("disabled", "disabled");
              }
          });
      });
  &lt;/script&gt;
  
  &lt;form id="fileForm" action='@Url.Action("UploadFile")' method="post" enctype="multipart/form-data"&gt;
      &lt;div&gt;
          Please use this template (link) to upload a list of employees and dependents.
      &lt;/div&gt;
      &lt;div class="center"&gt;
          &lt;br /&gt;
          &lt;input type="hidden" id="field1" name="field1" /&gt;
          &lt;input type="hidden" id="field2" name="field2" /&gt;
          &lt;input type="file" id="file" name="file" /&gt;&lt;br /&gt;&lt;br /&gt;
          &lt;input type="button" disabled="disabled" id="uploadFile" name="uploadFile" value="Upload File" class="greenButton" /&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>HomeController.cs</p>
  
  <pre><code>public ActionResult UploadFile()
  {
      return View();
  }
  
  [HttpPost]
  public ActionResult UploadFile(String field1, String field2, HttpPostedFileBase file)
  {
      ...do work...
  
      //return View("UploadFile", object);
      //return View("Result", object);
      //return ?
  }
  </code></pre>
  
  <p>The return part is where I'm stuck. What can I do to return the object to the partial view, without having the partial view load within the iframe? </p>
  
  <p>Any ideas or at least a point in the right direction would be appreciated. Even a link to a duplicate! </p>