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.
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 this SO post gave me hope.
jQuery
Employee.createEmployee(function (response) { $(window.opener.document).find('#mytable').html($.parseJSON(response)); }); So far all I'm able to do is get this error back:
Uncaught TypeError: Cannot read property 'document' of null I am launching the modal via javascript instead of data-attribute in hopes that would allow a better hook back to the parent window:
jQuery
$('#createemployeebtn').click(function (event) { $('#newemployeemodal').modal(); }); No such luck.
$(#mytable').html()