0
我有一个jQuery UI对话框,第一次发送数据的自定义按钮很好,但是当我再次点击一个新打开的对话框时,它会发送两次,然后三次,等等(没有页面重新加载)。如果我重新加载页面,它工作正常,但为什么?这是我的功能如何:uidialog多次发送表格
function openPopup() {
$('#box').dialog({
autoOpen: true,
modal : true,
title : 'my title',
width : 500,
open : function (event) {
var dialog = $(this);
$(".buttonclass").live('click', function(event) {
dialog.dialog('destroy');
alert('hello'); //This alerts hello once first time, twice second time, etc.
});
},
buttons : [
{
text: 'Cancel',
click: function() {
$(this).dialog("destroy");
}
}
]
});
}
我错过了什么?我一直在环顾四周,发现像点击解除绑定,对话框销毁,但没有任何工作(如你可以看到我破坏我的对话)。