我试图用下面的代码打开一个Jquery确认框。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()重定向。