关闭重定向jquery ui对话框

时间:2010-09-19 11:10:15

标签: javascript jquery user-interface dialog

我尝试了不同的方法来做到这一点,但我无法让它发挥作用。这是代码:

    $.ui.dialog.defaults.bgiframe = true;
$(function() {
    $("#category_edit_dialog").dialog({
        width: 960,
        hide: 'slide',
        position: 'top',
        show: 'slide',
        close: function(event, ui) { redirect here? how? }
    });
    });
});

感谢dekomote帮助我。根据他的建议,我解决了问题:这是完整的工作代码:

 $.ui.dialog.defaults.bgiframe = true;
$(function() {
    $("#category_edit_dialog").dialog({
        width: 960,
        hide: 'slide',
        position: 'top',
        show: 'slide',
        close: function(event, ui) { location.href = 'url here' }
    });
});

1 个答案:

答案 0 :(得分:21)

    $.ui.dialog.defaults.bgiframe = true;
    $(function() {
        $("#category_edit_dialog").dialog({
            width: 960,
            hide: 'slide',
            position: 'top',
            show: 'slide',
            close: function(event, ui) { window.location.href = "page.html"; }
        });
        });
    });

其中“page.html”是您希望在关闭时重定向的页面