I have an ajax function in jQuery that returns me a list of JSON object. From the data, I want to populate a timeline which is defined as follows:
Timeline
$('#timeline-container-basic').timelineMe({
items: [
{
type: 'smallItem',
label: 'Name',
shortContent: 'Address',
forcePosition: 'right'
},
{
type: 'smallItem',
label: 'Name2',
shortContent: 'Address2',
forcePosition: 'right'
}
]
});
The Ajax Function:
$.ajax({
url: 'GetCustomers',
type: 'GET',
dataType: 'json',
success: function (data) {
for (var i = 0; i < data.length; i++) {
console.log(data[i].Name);
}
What I want to achieve is that I want the items object to be populated from the ajax data. Could someone advise how can I achieve this ?