There is no magic in there - you need to implement the endpoint called by the onEventDeleted event handler ("/event/delete/id").
In PHP it could look like this:
HTML
<div id="dp"></div>
<script type="text/javascript">
var dp = new DayPilot.Calendar("dp");
dp.eventDeleteHandling = "Update";
dp.onEventDelete = function(args) {
if (!confirm("Do you really want to delete this event?")) {
args.preventDefault();
}
};
dp.onEventDeleted = function(args) {
// AJAX call to the server, this example uses jQuery
$.post(
"backend_delete.php",
{ id: args.e.id()},
function(result) {
dp.message(result.message); // "Delete successful" received from the server
}
);
};
// ...
dp.init();
</script>
backend_delete.php
<?php
require_once '_db.php';
$stmt = $db->prepare("DELETE FROM events WHERE id = :id");
$stmt->bindParam(':id', $_POST['id']);
$stmt->execute();
class Result {}
$response = new Result();
$response->result = 'OK';
$response->message = 'Delete successful';
header('Content-Type: application/json');
echo json_encode($response);
?>