[英]Bootstrap FullCalendar Uncaught TypeError: undefined is not a function
I'm working on FullCalendar to make a scheduler. 我正在使用FullCalendar制作调度程序。 I cannot seem to add any events to my mysql database because I get an error:
我似乎无法向我的mysql数据库添加任何事件,因为出现错误:
Uncaught TypeError: undefined is not a function. 未捕获的TypeError:未定义不是函数。
Chrome is highlighting the following line: Chrome浏览器突出显示以下行:
var start = $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss");
Any ideas why? 有什么想法吗? I have fullCalendar v 2.1.1.
我有fullCalendar v 2.1.1。 referenced properly.
引用正确。
Here's the full script. 这是完整的脚本。
//do all the calendar stuff for adding a new appt.
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $("#calendar").fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
slotDuration: '00:10:00',
defaultView: 'agendaWeek',
draggable: true,
events: 'json_appointments.php',
eventRender: function(event, element, view) {
if (event.allDay == true) {
event.allDay = true;
} else {
event.allDay = false;
}
},
eventClick: function(event, jsEvent, view) {
$('#modalTitle').html(event.title);
$('#modalBody').html(event.reason + ' ' + event.pre_notes);
$('#fullCalModal').modal();
},
loading: function(bool) {
if (bool) $('#loading').show();
else $('#loading').hide();
},
selectable: true,
selectHelper: true,
select: function(start, end, allDay) {
var title = prompt('Event Title:');
if (title) {
var start = $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss");
var end = $.fullCalendar.formatDate(end, "yyyy-MM-dd HH:mm:ss");
$.ajax({
url: 'ajax_add_appt.php',
data: 'title='+ title+'&start='+ start +'&end='+ end,
type: "POST",
success: function(json) {
alert('Added Successfully');
}
});
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allDay: allDay
},
true // make the event "stick"
);
}
calendar.fullCalendar('unselect');
},
eventDrop: function(event, delta) {
var start = $.fullCalendar.formatDate(event.start, "yyyy-MM-dd HH:mm:ss");
var end = $.fullCalendar.formatDate(event.end, "yyyy-MM-dd HH:mm:ss");
$.ajax({
url: '',
data: 'title='+ event.title+'&start='+ start +'&end='+ end +'&id='+ event.id ,
type: "POST",
success: function(json) {
alert("Updated Successfully");
}
});
},
eventResize: function(event) {
var start = $.fullCalendar.formatDate(event.start, "yyyy-MM-dd HH:mm:ss");
var end = $.fullCalendar.formatDate(event.end, "yyyy-MM-dd HH:mm:ss");
$.ajax({
url: 'http://localhost:8888/fullcalendar/update_events.php',
data: 'title='+ event.title+'&start='+ start +'&end='+ end +'&id='+ event.id ,
type: "POST",
success: function(json) {
alert("Updated Successfully");
}
});
}
});
Thanks for the comments. 感谢您的评论。 I did have moment.js referenced.
我确实引用了moment.js。
I just had to edit my script like this: 我只需要像这样编辑我的脚本:
var start=moment(start).format('YYYY-MM-DDTHH:mm:ssZ');
var end=moment(end).format('YYYY-MM-DDTHH:mm:ssZ');
... based on the other stack link that Alvaro mentioned. ...基于Alvaro提到的另一个堆栈链接。 Thank you.
谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.