Javascript 关闭时重定向 jquery ui 对话框

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3745427/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 05:58:15  来源:igfitidea点击:

Redirect jquery ui dialog on close

javascriptjqueryuser-interfacedialog

提问by ciprian

I tried different ways to do this but i cant get it work. this is the code:

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

    $.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? }
    });
    });
});

Thanks dekomote for helping me. At his advice i solved the problem: here is the full working code:

感谢 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' }
    });
});

回答by chris.rickard

    $.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"; }
        });
        });
    });

where "page.html" is the page you wish to redirect to on close

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