I get some data from an PHP-Script via AJAX and want to have the return value as an event listed in my fullcalendar. But somehow it didn’t work! I copied the example from the fullcalendar documentation and modified it a little bit:
$.ajax({
type: "POST",
url: "content/con_FillDatesToPopulateEvent.php",
data: {
start: startStr,
end: endStr,
},
success: function (returnVal) {
var events = [];
singleEvents = returnVal.split("|");
$.each(singleEvents, function(i, val){
events.push(val);
});
callback(events);
}
});
If I display the return value of my PHP-Script the events are looking fine:
{
id: 15,
title: '???',
start: '2012-06-11 11:00:00',
end: '2012-06-13 11:00:00',
url: '#',
allDay: false,
color: 'Orange'
},
{
id: 7,
title: '???',
start: '2012-05-28 08:00:00',
end: '2012-06-10 08:00:00',
allDay: false,
color: 'Orange'
},
{
id: 6,
title: '???',
start: '2012-05-21 08:00:00',
end: '2012-05-28 08:00:00',
allDay: false,
color: 'Orange'
}
As far as I understand all events should be added to the fullcalendar by the call of “callback()”? Do you see my problem and can you give me a hint how to fix it? I’m searching for a while on the internet without an satisfying solution!
Thanks for your help in advance!
When you call .fullCalendar, you can pass in a parameter “events” which defines a JSON source for the events. Example:
and that should be all you need to populate the events. Your code isn’t clear on what
callbackis or does.