user1361389
user1361389

Reputation: 55

Jquery dialog load page prevent dialog to close when form is submitted

i am building a page that once i click on a link it call's the function modal and the url of the page to be oppened on the dialog, the page that load's in the dialog contains a form , the problem is that once i submit the form the dialog closes instead of maintain the dialog open.

is is possible to maintain the dialog open once the form has been submitted from the dialog page?

below there's the jquery code:

thanks

$(document).ready(function() {
    $("#dialog").dialog({
        autoOpen: false,
        modal: true,
        width: 400,
        height: 400,
        close: function(event, ui) {
            $("#dialog").html("");
        }
    });
});

function modal(url) {
    $(document).ready(function() {
        $("#dialog").load(url).dialog('open');
    });
}​

Upvotes: 1

Views: 1438

Answers (1)

Anton Baksheiev
Anton Baksheiev

Reputation: 2251

You can add your own event on submit

$(document).ready( function() {
    $('#commentform').submit( function() {
        // submit data with $.POST, $.GET, $.AJAX
        return false;
    });
});

'commentform' - id of your form into 'dialog'

Upvotes: 1

Related Questions