开发者

jQuery Modal Dialog - I must be missing a simple thing

开发者 https://www.devze.com 2023-04-13 05:26 出处:网络
I have a php page that needs a modal confirmation. When clicking \"Please confirm\" on the dialog, I want the page post to continue. How in the world can I accomplish this?

I have a php page that needs a modal confirmation.

When clicking "Please confirm" on the dialog, I want the page post to continue. How in the world can I accomplish this?

Here is my js code so far:

   $(document).ready(function() {
    var $dialog = $('<div></div>')
        .dialog({
            autoOpen: false,
            title: 'Are you sure?',
            modal: true,
            closeOnEscape: true,
            buttons: {
                "Please confirm": function() {
                 // want to continue the post that was interrupted 
                 // b开发者_如何学Pythony this dialog
                $("#account_mgr").submit();
                $( this ).dialog( "close" );
                },
                Cancel: function() {
                $( this ).dialog( "close" );
                window.location = "/account_mgr#MySubscription";
                }
            }
        });

//  $('#btnSubscription').click(function() {
    $('#btnSubscription').live('click', function() {
        $dialog.dialog('open');
        return false;
    });
});


Assuming the button otherwise posts a form, then just submit the form;

        buttons: {
            "Please confirm": function() {
                $( this ).dialog( "close" );
                $('#btnSubscription').parents('form').submit();
            },
            Cancel: function() {
            $( this ).dialog( "close" );
            window.location = "/account_mgr#MySubscription";
            }
        }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号