I have a jQuery modal dialog that loads a different page on an iframe.
The iframed page has a form in it and i’m trying to get it to close the jQuery modal dialog automatically after the user submitted the form.
Is that even possible?
Thanks,
LoadModal code (on first.html):
<script type="text/javascript">
function showModal(url) {
$(function() {
var $this = $(this);
var horizontalPadding = 30;
var verticalPadding = 30;
$('<iframe id="externalSite" scrolling="no" frameborder="0" class="externalSite" src="' + url + '" />').dialog({
title: ($this.attr('title')) ? $this.attr('title') : 'Choose your location',
autoOpen: true,
width: 700,
height: 700,
modal: true,
resizable: true,
autoResize: true,
overlay: {
opacity: 0.5,
background: "black"
}
}).width(700 - horizontalPadding).height(700 - verticalPadding);
});
}
</script>
<button onclick="showModal('/iframe.html');">Add</button>
iframe code (iframe.html)
<html>
<body>
<form action="" method="POST">
<input type="text" name="test">
<input type="submit">
</body>
</html>
after iframe form is submitted, I would like to close the dialog opened by first.html jQuery function.
if that means that you want to close the dialog from inside the iframe, you could try something like that
if needed i can provide a complete example later…