It looks like your PHP is checking for which button is clicked. jQuery does not include the buttons when you submit a form via $('#confirm').submit();
. The browser will only include the buttons in the submission if the button was actually clicked.
There are a couple ways to get the button name/value pair to be included in the submission.
You can use $('form').serializeArray();
and push the doDelete/Delete pair as described in this answer
Or you might be able to get away with doing something like this. Notice the click of the delete button is called a second time. The button click event checks if it was initiated via a trigger (aka the dialog). The second time around, it will not be prevented from being submitted.
$(function () {
$("#dialog-confirm-multiple").dialog({
autoOpen: false,
resizable: false,
width: 300,
modal: true,
show: {
effect: "bounce",
duration: 100
},
hide: "drop",
buttons: {
"Yes": function () {
$(this).dialog("close");
$("#doDelete").click();
},
"No": function () {
$(this).dialog("close");
}
}
});
$("#doDelete").click(function (e,ui) {
if(e.originalEvent) {
e.preventDefault();
$("#dialog-confirm-multiple").dialog('open');
return false;
}
});
});
The fiddle is here