title: Pass data to parent window from modal using Bootstrap
body: <p>As an example, I have a page that when loads, lists all employees. There is a button on the page that when clicked, initializes a (bootstrap) modal with a form. I populate the form, and click 'Submit'. If the insert was successful, I get the json object back as a response so that I can add the newly created employee to the list - which is behind the modal - without a page refresh.</p>
  
  <p>Everything is working fine. I am getting the json back - and I'm ready to send the data back to the parent window. I knew it would be somewhat tricky, but <a href="https://stackoverflow.com/questions/19451972/how-to-update-div-outside-bootstrap-modal">this SO post gave me hope</a>.</p>
  
  <p><strong>jQuery</strong></p>
  
  <pre><code>Employee.createEmployee(function (response) {
      $(window.opener.document).find('#mytable').html($.parseJSON(response));
  });
  </code></pre>
  
  <p>So far all I'm able to do is get this error back:</p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'document' of null
  </code></pre>
  
  <p>I am launching the modal via javascript instead of data-attribute in hopes that would allow a better hook back to the parent window:</p>
  
  <p><strong>jQuery</strong></p>
  
  <pre><code>$('#createemployeebtn').click(function (event) {
      $('#newemployeemodal').modal();
  });
  </code></pre>
  
  <p>No such luck.</p>