Reputation: 535
The console logs the string(i.e title) and at the Network tab shows that the string was posted. But I can't seem to get the calendar to display it on the screen even though I am using $('#calendar').fullCalendar('addEventSource', json);
to get back the events from the json source on success.
Any inputs on how to check this or how to get the events to display would be appreciated.
Json response when a console.log is done on it : Salah[{"id":"24","title":"Salah","start":"2016-06-02 10:00:00","end":"2016-06-02 14:30:00","url":null,"allDay":false,"color":null},{"id":"26","title":"Salah","start":"2016-06-23 08:30:00","end":"2016-06-23 11:30:00","url":null,"allDay":false,"color":"green"}]
The above error is logged into the console and it prevents these events from bring displayed on the calendar.
Upvotes: 1
Views: 407
Reputation: 81
The issue is with the JSON object name you should used the unnamed object instead of using the object Salah
. In back-end API please return the info with out the array key in the format as stated below.
[{"id":"24","title":"Salah","start":"2016-06-02 10:00:00","end":"2016-06-02 14:30:00","url":null,"allDay":false,"color":null},
{"id":"26","title":"Salah","start":"2016-06-23 08:30:00","end":"2016-06-23 11:30:00","url":null,"allDay":false,"color":"green"}]
Or you may change the format like response.Salah
on front-end.
Upvotes: 2