【发布时间】:2010-08-03 00:40:36
【问题描述】:
我对 FullCalendar 还很陌生,但我非常喜欢它的功能。
我正在尝试使用 dayClick 函数。也许有人可以指引我正确的方向。
我目前有这个:
dayClick: function (date, allDay, jsEvent, view) {
var titleNew = prompt('Event Title:');
var thedate1 = formatDate(date);
$.ajax({
url: "classes/class.Post.php?a=dayClickCalendarEvent",
dataType: 'json',
data: {
title: titleNew,
start: thedate1,
end: thedate1
},
success: function (data, response, event, date) {
$('#calendar').fullCalendar('renderEvent', titleNew);
},
error: function () {
alert("Oops! Something didn't work");
}
});
},
我的问题是无论如何我都无法将事件渲染到日历中。
我错过了什么吗?我正在使用calEvent,我在另一个 Stack Overflow 帖子中找到了它。
这是我的格式代码:
function formatDate(date1) {
return date1.getFullYear() +'-'
+ (date1.getMonth() < 9 ? '0' : '')
+ (date1.getMonth()+1) +'-'
+ (date1.getDate() < 10 ? '0' : '')
+ date1.getDate() +' '
+ (date1.getHours() < 10 ? '0' : '')
+ date1.getHours() +':'
+ (date1.getMinutes() < 10 ? '0' : '')
+ date1.getMinutes();
}
任何帮助将不胜感激。
【问题讨论】:
-
我认为 formatDate 可能未定义。你在范围内吗?我认为您可能需要使用 $.fullCalendar.formatDate。
-
我的格式不会影响任何其他事件,这很奇怪。这是我的格式代码。 function formatDate(date1) { return date1.getFullYear() +'-'+ (date1.getMonth()
标签: jquery fullcalendar jquery-events