below is my code for confirmation dialog and sending data with ajax.
In this code, the Delete button event under the first dialog is breaking the code and if I click the delete button nothing happens in page.
And if I remove the ajax code in Delete button event, there is no problem again.
I should send the data if I click the Delete button.
How can I fix the code, thanks for your helps.
$("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" );
}
}
});
}
});
});
I believe you didn’t close the open paren from
(the one in your Delete: function)