我正在尝试使用以下代码打开一个 Jquery 确认框。
var a = $('#confirm')                
            .data("x","defaultValue")
            .dialog('open');
alert(a.data("x"));
在对话框中,我尝试更改 x 的值。
    $("#confirm").dialog({
    resizable: false,
    autoOpen: false,
    height: 180,
    width: 400,
    modal: true,
    buttons: {
        "Leave the page": function() {                
            $(this).data("x","this is a test");                
            $(this).dialog("close");
        },
        Cancel: function() {
            $(this).dialog("close");
        }
    }
});
如何获得 x 的修改值。目前警报显示“DefaultValue”。但想得到“这是一个测试”。
有什么想法吗?
PS:我无法在对话框中使用 window.open() 进行重定向。