This seems like it would be a pretty wide-spread use for simplemodal but I cannot find how to do it anywhere.
I am pulling up a page via iframe using simplemodal, generating a variable, then I would like to pass it back to the parent page when the modal is closed.
How would I go about doing this?
Thanks for any help!
how do you mean pass it back? jquery? If you are not on the same domain, protocol, or otherwise have the document.domain set up correctly then you will run into errors with the following snippet, but you could try something like the following to access the parent page's DOM.
window.parent.$
So let's say you have this function on the parent page,
function UpdateTheHeaderPlease(data) {
$('.header').replaceWith(data);
}
then you have this code wrapped up in the simplemodal callback OnClose:
$("#element-id").modal({onClose: function (dialog) {
window.parent.UpdateTheHeaderPlease(some data);
});