Javascript 如何将当前月份发送到jQuery FullCalendar
我正在尝试使用jquery 我找不到如何检索用户在某个时刻的当前月份 在渲染时,它在标题中设置为当前月份,但我找不到使用该信息的方法。我想把这个月连同其他参数(开始、结束、结束)一起发送给我的ajax调用,但我不知道如何发送Javascript 如何将当前月份发送到jQuery FullCalendar,javascript,jquery,calendar,fullcalendar,Javascript,Jquery,Calendar,Fullcalendar,我正在尝试使用jquery 我找不到如何检索用户在某个时刻的当前月份 在渲染时,它在标题中设置为当前月份,但我找不到使用该信息的方法。我想把这个月连同其他参数(开始、结束、结束)一起发送给我的ajax调用,但我不知道如何发送 在fullcalendar定义中,如何检索当前显示的月份?很抱歉响应太晚。以下是您想要的: 函数getMonth()将返回月份的整数。以下以长格式显示当前月份,但可以返回许多其他格式: $('#calendar').fullCalendar('addEvent
在
fullcalendar
定义中,如何检索当前显示的月份?很抱歉响应太晚。以下是您想要的:
函数getMonth()将返回月份的整数。以下以长格式显示当前月份,但可以返回许多其他格式:
$('#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
});
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 :)