jquery.timeline icon indicating copy to clipboard operation
jquery.timeline copied to clipboard

Remote events data

Open DeltaServiceSoftware opened this issue 1 year ago • 2 comments

Hi, Is it possible to receive event data, in json format, from a remote resource? Thanks for help.

DeltaServiceSoftware avatar Nov 03 '23 08:11 DeltaServiceSoftware

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.

ka215 avatar Nov 05 '23 07:11 ka215

Timeline

It works! Thanks so much

DeltaServiceSoftware avatar Nov 06 '23 07:11 DeltaServiceSoftware