How do I send current month to jQuery FullCalendar
I'm trying to use jquery Full Calendar
I could not find how I can retrieve the current month a user is on at a certain moment.
On render, it is set as the current month in the title, but I can't find a way to use that info. I want to send the month to my ajax call together with additional params (start, end, _) but I don't know how.
Inside the fullcalendar
definition开发者_运维技巧, how do I retrieve the month currently displayed?
sorry for the really late response. here is what you would want: http://arshaw.com/fullcalendar/docs/current_date/getDate/
The following shows the current month in long format but can return many other formats: http://arshaw.com/fullcalendar/docs/utilities/formatDate/
var curDate = $('#calendar').fullCalendar('getDate');
alert("The current month of the calendar is " + $.fullCalendar.formatDate(curDate, "MMMM")); // Corrected the typo of currDate to curDate but thanks :)
$('#calendar').fullCalendar('addEventSource', function (start, end, callback) {
date = new Date(start);
alert(date.getMonth());
$.ajax({
type: 'POST',
url: '/Employee/GetScheduleDetailedArray/',
async: false,
dataType: "json",
data: {
// our hypothetical feed requires UNIX timestamps
start: start,
end: end,
id: 1,
currentDate: $('#calendar').fullCalendar('getDate'),
currentMonth: date.getMonth()
},
success: function (doc) {
callback(doc);
},
error: function (xhr, status, error) {
document.appendChild(xhr.responseText);
}
}); //end ajax
});
the function getMonth() will return an integer of the month.
精彩评论