0
下面是我的代码确认对话框和发送数据与Ajax。
在此代码中,第一个对话框下的删除按钮事件正在破坏代码,如果我单击删除按钮,则页面中不会发生任何事情。
如果我删除删除按钮事件中的ajax代码,再次没有问题。
我应该发送数据,如果我点击删除按钮。
如何修复代码,谢谢你的帮助。jQuery Ajax和对话框
$("input.delete").live("click", function(){
$.ajax({
type: "POST",
url: "forms.php",
cache: false,
dataType: "json",
data: {action: 'confirm', ntag: $('input.tag').val() == 'something' ? '' : $('input.tag').val()},
success: function(data){
$(".dialog p").html(data.message);
var ids=data.ids;
$(".dialog").dialog({
resizable: true,
width: 500,
height: 200,
modal: true,
buttons: {
"Delete": function() {
$.ajax({
type: "POST",
url: "forms.php",
cache: false,
dataType: "html",
data: {action: 'delete', ntag: ids},
context: $(this),
success: function(data){
$(".dialog p").html("deleted!");
$(".dialog").dialog('open');
}
}
},
"Update": function() {
document.location.href='edit.php';
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
}
});
});
感谢我错过了:)。 – tewoos 2012-02-02 22:33:04
好的,如果我回答了您的问题,请点击复选标记。 (你得到+2代表做顺便说一句)。 – Gus 2012-02-02 22:40:47