I setup my fullCalendar instance to get events from a function.
It works if I hardcode the dates, but how do I wire up the navigational buttons to go back and forth between months?
It doesn't pass any parameters and I can't think of how to make this work.
Here is where I call fullCalendar:
var calendar = $('#calendar').fullCalendar({
events: getCalendarEvents //events as a function
});
This is the function it uses:
var lastDayofLastMonth = '8-31-2014'
var lastDayofCurrentMonth = '9-30-2014'
var getCalendarEvents = (function (start, end, timezone, callback) {
return $.ajax("/api/events/" + lastDayofLastMonth + "/" + lastDayofCurrentMonth, {
type: "GET",
contentType: "application/json",
success: function(response, status, XHR) {
var calObj = [];
$.each(response, function (index, item) {
var evt = {
title: item.title,
start: item.startDateTime,
end: item.endDateTime
};
calObj.push(evt);
});
callback(calObj);
}
});
});
Thanks