jQuery对话框在同一页面中打开链接

时间:2011-02-01 21:24:55

标签: jquery url hyperlink dialog

我有一个对话框,其中有两个按钮'取消'和'打开',当我点击打开时,我想在同一页面中加载一个网址。

这是我的代码:

$("#delete_wind").dialog({ autoOpen: false })   
    $( "#delete_wind" ).dialog({
        resizable: false,
        height:'auto',
        width:350,
        modal: true,
        buttons: {"OPEN Message": function() {
        url=('mailbox.php?id='+jQuery.data(document.body, 'elimina_id'));

            **HOW OPEN URL??????**
            $( this ).dialog( "close" );

            },
            "Annulla": function() {
                $( this ).dialog( "close" );
            }
        }
});

2 个答案:

答案 0 :(得分:1)

好吧,你可以设置window.location.href属性:

location.href = '/' + 'mailbox.php?id='+jQuery.data(document.body, 'elimina_id');

答案 1 :(得分:0)

如果要在对话框中打开URL,请尝试以下操作:

$("#delete_wind").dialog({ autoOpen: false })   
    $( "#delete_wind" ).dialog({
        resizable: false,
        height:'auto',
        width:350,
        modal: true,
        buttons: {"OPEN Message": function() {
        url=('mailbox.php?id='+jQuery.data(document.body, 'elimina_id'));

            $.get('yoururl.php'.function(data){
                 $('#delete_wind').html(data);
            });
            $( this ).dialog( "close" );

            },
            "Annulla": function() {
                $( this ).dialog( "close" );
            }
        }
});