开发者

Load another page within a JQuery UI modal (from within the JQuery UI modal...)

开发者 https://www.devze.com 2023-03-26 22:30 出处:网络
I have a JQuery UI modal: $(\'#avatar-manager\').click(function () { $(\'#dialog\').dialog(\'open\'); return false开发者_JAVA技巧;

I have a JQuery UI modal:

$('#avatar-manager').click(function () {
                $('#dialog').dialog('open');
                return false开发者_JAVA技巧;
            });

            $('#dialog').dialog({
                autoOpen: false,
                resizeable: false,
                modal: true,
                position: 'center',
                width: 600,
                open: function () {
                    $(this).load('/a/path/to/my/page.aspx');
                }
            });

And it works wonderfully. page.aspx (example name) contains my upload functionality for images. What I'd like to do is on completion of the upload, to redirect the user to another modal:

uploader.bind('FileUploaded', function (up, file, obj) {
            alert("I've done uploading stuff...");
            //redirect to another modal here...
        });

I know I can't use windows.location and the like, because that will change the main parent window, so I'm not sure how - or even if I can - do this...


Have you tried simply close the current dialog and open another one?

    $('#dialog2').dialog({
        autoOpen: false;
        modal: true
    });

    uploader.bind('FileUploaded', function (up, file, obj) {
        $('#dialog').dialog('close');
        $('#dialog2').html('Upload finished').dialog('open');
    });

Edit:

You can refer to the dialog several ways depending on how you want to do it. If you want absolute reference, just use $('#dialog'); if you want a relative reference, you could make use of $.proxy(), apply() or call() to pass in the dialog as the substituting context, so you can use $(this) to refer to the dialog.

0

精彩评论

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