Javascript can't connect directly to a database, but it can request data from external pages, files.
I use PHP, and a MS SQL database.
I have created an API were I can request data for my scheduler,
So, my PHP file, "get_task.php", creates an JSON file that I can call from my calendar view.
[JSON data example]
[{start:"2018-06-01",start:"2018-06-05",id:5,resource:"G1",html:"<b>some html</b>",htmlcolor:"#c3c3c3"},{start:"2018-06-08",start:"2018-06-10",id:6,resource:"G3",html:"<b>some html</b>",htmlcolor:"#c3c3c3"}]
DayPilot / Jquery function to add tasks:
$.getJSON( "api/get_tasks.php", function(data) {
$.each(data, function( index, value ) {
var e = new DayPilot.Event({
start: value.datefrom,
end: value.dateto,
id: value.taskid,
resource: value.resource,
html: value.html,
barColor: value.htmlcolor,
});
dp.events.add(e);
});
});
I hope it can help you in the right direction.