开发者

Changing the inner HTML in a SimpleModal dialog?

I'm using the beforeSubmit function of the jQuery form pluggin in order to close a modal dialog, and I want another one to popup after-wards with the result of the form being submitted, so I put another modal in the success function and passing through the responseText... but the new modal dialog never pops up... how can I get it to pop up? I would also like to know how to change the innerHTML of the dialog box. I tried dialog.data.html(responseText); and some other stuff, but none of it worked.

Here's the code for the form submit:

$('#member_ban_forum').ajaxForm( { 
    开发者_开发问答data: { member: member }, beforeSubmit: function() { 
        $.modal.close();
    },

    success: function (responseText) {
        $().delay(5000, function () {
            simpleModal(responseText);
        });
    }
});

Here's the code for the simpleModal popup function I made:

function simpleModal ( html ) {
    $(html).modal({
        containerCss:{
            height:340,
            width:450
        },

        onOpen: function (dialog) {
            dialog.overlay.fadeIn(350, function () {
                dialog.container.fadeIn(350, function () {
                    dialog.data.slideDown(350);
                });
            });
        },

        onClose: function (dialog) {
            dialog.data.slideUp(350, function () {
                dialog.container.fadeOut(350, function () {
                    dialog.overlay.fadeOut(350, function () {
                        $.modal.close();
                    });
                });
            });
        }
    });
}


I could be wrong, but I think the problem is with your use of delay().

The following works for me:

$('#member_ban_forum').ajaxForm( { 
    data: { member: member },
    beforeSubmit: function() { 
        $.modal.close();
    },
    success: function (responseText) {
        setTimeout(function () {
            simpleModal(responseText);
        }, 5000);
    }
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜