You need to return the ID of the new event from the server after saving the new record in the database. Then you can add the event to the Scheduler using events.add(). Please take a look at the following tutorial:
https://code.daypilot.org/87166/html5-scheduler
dp.onTimeRangeSelected = function (args) {
var form = [
{name: "Text", id: "text"},
{name: "Start", id: "start", dateFormat: "M/d/yyyy h:mm:ss tt"},
{name: "End", id: "end", dateFormat: "M/d/yyyy h:mm:ss tt"},
{name: "Resource", id: "resource", options: flatten(dp.resources)}
];
var data = {
start: args.start,
end: args.end,
resource: args.resource,
text: "New event"
};
var options = {
focus: "text"
};
DayPilot.Modal.form(form, data, options).then(function(modal) {
dp.clearSelection();
if (modal.canceled) {
return;
}
DayPilot.Http.ajax({
url: "backend_create.php",
data: modal.result,
success: function(response) {
var e = {
id: response.data.id,
start: modal.result.start,
end: modal.result.end,
text: modal.result.text,
resource: modal.result.resource
};
dp.events.add(e);
dp.message("Created.");
}
});
});
};