[英]Problems using FullCalendar with ajax
I'm using FullCalendar 2.2.3 and I want to update the DB when users modify any of its events.我正在使用 FullCalendar 2.2.3 并且我想在用户修改其任何事件时更新数据库。 This is the definition of the calendar:
这是日历的定义:
$('#calendar').fullCalendar({
firstDay: 1,
timezone: 'Europe/Madrid',
allDayDefault: false,
theme: false,
aspectRatio: 2.2,
timeFormat: 'H:mm',
header: {
left: '',
center: 'title',
right: 'today prev,next'
},
editable: false,
eventMouseover: function(event, jsEvent, view) {
if (view.name !== 'agendaDay') {
$(jsEvent.target).attr('title', event.title);
}
},
events: {
url: '/getEvents.php',
type: 'POST',
cache: false,
error: function() {
// error
},
},
eventDrop: function(event, delta, revertFunc) {
if (!confirm("Are you sure about this change?")) {
revertFunc();
}
}
});
This works fine, but when I change eventDrop to update the DB这工作正常,但是当我更改 eventDrop 以更新数据库时
eventDrop: function(event, delta, revertFunc) {
var parameters = {
"idevento" : event.id,
"fecha" : event.start
};
$.ajax({
type: "POST",
data: parameters,
url: '/cambiarFechaEventoUsuario.php',
success: function(data) {
var res = jQuery.parseJSON(data);
if (res.error == 0) {
alert('OK');
}
else {
alert('No OK');
}
},
error: function(e) {
alert('Server error');
}
});
}
I get the following error:我收到以下错误:
TypeError: this._ordinalParse is undefined
类型错误:this._ordinalParse 未定义
moment.min.js (línea 6, col 17468)
moment.min.js (line 6, col 17468)
Also, if I use the file "es.js" (I'm spanish), I get a different error:另外,如果我使用文件“es.js”(我是西班牙语),我会收到一个不同的错误:
TypeError: e is undefined
类型错误:e 未定义
es.js (línea 1, col 453)
es.js (line 1, col 453)
I haven't changed anything about either of these two js files, obviously.显然,我没有更改这两个 js 文件中的任何一个。
Does anyone know how to fix this?有谁知道如何解决这一问题?
Thanks in advance and sorry for my english :(预先感谢并为我的英语感到抱歉:(
I just found out the solution.我刚刚找到了解决方案。 If anyone has the same problem, the error comes from the date format.
如果有人遇到同样的问题,则错误来自日期格式。
event.start.format("YYYY-MM-DD")
Just changing the date format works perfectly.只需更改日期格式即可完美运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.