Jquery-ui,单击关闭按钮后重定向到某个页面

时间:2010-12-01 19:49:10

标签: jquery jquery-ui

单击关闭按钮后如何重定向?

$(document).ready(function() {
    var $dialog = $('<div></div>')
        .html('This dialog will show every time!')
        .dialog({
            autoOpen: false,
            title: 'Basic Dialog'
        });

    $('#opener').click(function() {
        $dialog.dialog('open');
        // prevent the default action, e.g., following a link
        return false;
    });
});

2 个答案:

答案 0 :(得分:2)

使用

location.href="url";

你可以像这样获得bindevent

//给你的popupid

$('div#popupid').bind('dialogclose', function(event) {
     alert('closed');
     location.href="new url";
 });

答案 1 :(得分:1)

您也可以通过以下方式为close事件定义回调:

$(document).ready(function() {
    var $dialog = $('<div></div>')
        .html('This dialog will show every time!')
        .dialog({
            autoOpen: false,
            title: 'Basic Dialog',
            close: function(ui, event) {
               $(this).dialog('close');
               // redirect over here.
            }
        });
});