ниже - мой код для диалогового окна подтверждения и отправки данных с помощью ajax.
В этом коде событие кнопки «Удалить» в первом диалоговом окне нарушает код, и если я нажимаю кнопку удаления, на странице ничего не происходит.
И если я удаляю код 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" );
}
}
});
}
});
});