title: Close jQuery UI dialog from page loaded within iframe
body: <p>I know there are a lot of threads regarding this topic out there, but none of them have helped me in what I am trying to do.  </p>
  
  <p>I am attempting to get an old system away from <code>window.showModalDialog()</code> and using jQuery UI dialogs, and am trying to do it with minimal changes, which is turning into an issue because of all of the outdated javascript and stuff in here.  </p>
  
  <p>Initial Page:</p>
  
  <pre><code>$(document).ready(function(){
                  $("#searchDialog").dialog({
                  position: "center",
                  autoOpen: false,
                  draggable: false,
                  resizable: false,
                  height: 650,
                  width: 650,
                  modal: true,
                  dialogClass: 'searchDialog',
                  closeOnEscape: true
              }); 
              $('.searchDialog .ui-dialog-titlebar').each(function () {
                  $(this).css("display", "none");
              });
  
          });
      &lt;div id="searchDialog" style="display:none; height: 650px; width:650px;"&gt;
         &lt;iframe id="searchDialogiFrame" style="height: 625px; width: 625px;"&gt;&lt;/iframe&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>on a button click a function basically loads a URL passed in into the iFrame contained in the dialog div</p>
  
  <pre><code>function openModalWindow(sURL,sName,sFeatures,bReplace){
      $('#searchDialogiFrame').attr('src', sURL);
      $('#searchDialog').dialog('open');
  }
  </code></pre>
  
  <p>The issue is how the system was built I load a page that then includes some UserControls for the buttons on that page to Add an account or 'Cancel' the transaction, so I am unsure in the DOM of how I would actually close this page after the Click event of the 'Add' button is pressed.</p>
  
  <p>Using the code</p>
  
  <pre><code>$('#searchDialog').dialog('close'); or
  window.parent.$('#searchDialog').dialog('close');
  </code></pre>
  
  <p>This code does not work.  After that, I don't know how to figure out how to traverse through the DOM to figure what call would work to close that dialog.</p>