You can use something like this:
An example using DayPilot.request():
function loadResources() {
DayPilot.request("backend_resources.php", function(result) {
var data = eval("(" + result.responseText + ")");
dp.resources = data;
dp.update();
});
}
An example using jQuery:
function loadResources() {
$.post("backend_resources.php",
function(data) {
dp.resources = data;
dp.update();
});
}
The backend_resources.php should return an array of resources.
Flat resource structure:
[
{ name: "Room A", id: "A" },
{ name: "Room B", id: "B" },
{ name: "Room C", id: "C" }
]
Resource tree:
[
{ name: "Room A", id: "A", expanded: true, children:
[
{ name : "Room A.1", id : "A.1" },
{ name : "Room A.2", id : "A.2" }
]
},
{ name: "Room B", id: "B" },
{ name: "Room C", id: "C" }
]