I want to let the user confirm to deletion of a record by letting them click on the button and the button sends the value Yes to a $_POST request so I can delete the record with PHP, instead it's showing me the javascript file that contains the function.
What am I doing wrong, I've been tinkering and searching for 3 hours straight, while in the back of my mind I know it's a easy fix.
Any help is greatly appreciated.
If you think there is a smarter way to be doing this, please let me know.
$(function () {
$("#DeleteConfirm").dialog({
buttons: {
"Confirm": function() {
var DeleteConfirmation = "Yes";
$.ajax({
type: "POST",
url: "index.php",
data: DeleteConfirmation,
success: function(DeleteConfirmation){
alert(DeleteConfirmation);
},
dataType: "text"
});
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
});