jquery.timeline
jquery.timeline copied to clipboard
Remote events data
Hi, Is it possible to receive event data, in json format, from a remote resource? Thanks for help.
Yes, you can do this by generating or updating the timeline after fetching the remote JSON data. Example of generating a timeline after fetching JSON data:
fetch("/path/to/getJsonEvents").then(response => {
if (response.ok) {
const events = response.json();
$('#my-timeline').Timeline({ eventData: events });
}
});
Or, example of obtaining and adding JSON data for an event to an already generated timeline:
$('#my-timeline').Timeline();
fetch("/path/to/getJsonEvents").then(response => {
if (response.ok) {
const events = response.json();
$('#my-timeline').Timeline('addEvent', events);
}
});
Best to try.
Timeline
It works! Thanks so much