Question

I've got a simplemodal box which loads a login for in an iframe on the click of a link:

$(".tab-link-register-login a").click(function(e) {
    var src = "/static/goal/html/login.html";
    $.modal('<iframe src="' + src + '" height="240" width="690" style="border: 0;">', {
        containerCss:{
            height: 360,
            padding: 0,
            width: 730
        },
        opacity: 80,
        overlayClose: true,
        overlayCss: {
            backgroundColor: '#FFF'
        }
    })
    e.stopPropagation();
    return false;
});

When this form submits, I'd like to close the modal and refresh the parent page, essentially.

I've tried running $.modal.close on click and submit before letting the form action but to no avail, the resulting page loads within the modal window.

$('#login form').click(function(){
    $.modal.close();
    return true;
});

Is there a way of doing this using this plugin?

-- edit --

I've found that you can close the modal using parent.$.modal.close(); but it's not submitting the form afterwards. Still working towards this...

Was it helpful?

Solution

Adding target="_parent" to the form element within the iframe sorts this out

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top