我正在使用FullCalendar一个时间表,我已经打了一个有点障碍的。我想利用这次活动的回调函数来创建一个新的事件,并发送新的事件的信息,以我的PHP脚本,然后存储的信息到服务器。但每当我试图调用$阿贾克斯或$。员额从内部回调之一(和我已经在少数人试过,如果从与)我得到这样的:
未捕获的类型错误:无法读取未定义moment.js财产月:684
extend.monthsShort moment.js:684
Ëjquery.min.js:4
BC jquery.min.js:4
BC jquery.min.js:4
BC jquery.min.js:4
n.param jquery.min.js:4
n.extend.ajax jquery.min.js:4
$ .fullCalendar.select advisorSchedule.js:141
Q fullcalendar.min.js:6
小号fullcalendar.min.js:7
一个fullcalendar.min.js:7
(匿名函数)fullcalendar.min.js:6
ðjquery.min.js:3
n.event.dispatch jquery.min.js:3
r.handle
不过,因为我用Moment.min.js它是有点难以阅读那里的问题是从哪里来的,所以我代替Moment.min.js与Moment.js,当错误弹出一次我能看那里的问题是:
月:功能(M){
返回this._months [m.month()];
},
从我收集的,M是此功能的执行时间不确定。 下面是用于发布新的事件数据的PHP脚本的codeI:
选择:功能(开始,结束,jsEvent,视图){
CURRENT_SELECTION_START =启动;
CURRENT_SELECTION_END =结束;
的console.log(CURRENT_SELECTION_START +' - '+ CURRENT_SELECTION_END);
$阿贾克斯({
网址:'../ AJAX / save_event.php',
键入:POST,
数据: {
START_TIME:开始,
EVENT_TITLE:提示(标题),
END_TIME:结束
},
});
},
解决方案
我想开始一个时刻对象。
我有同样的问题,似乎:你不能发送的那一刻对象,所以你需要得到的值作为一个整数或其他什么东西
。尝试 start.calendar()
或 start.format(YYYY-MM-DD);
(或类似的东西来代替)启动
。
为我工作,希望对你也;)
帕特里克
I am working on a schedule using FullCalendar and i have hit a bit of a snag. I am trying to use the event callback functions to create a new event, and send the new event's information to my php script which then stores the information to the server. But whenever i try to call $.ajax or $.post from within one of the callbacks (and i have tried if from with in a few of them) i get this:
Uncaught TypeError: Cannot read property 'month' of undefined moment.js:684
extend.monthsShort moment.js:684
e jquery.min.js:4
Bc jquery.min.js:4
Bc jquery.min.js:4
Bc jquery.min.js:4
n.param jquery.min.js:4
n.extend.ajax jquery.min.js:4
$.fullCalendar.select advisorSchedule.js:141
Q fullcalendar.min.js:6
s fullcalendar.min.js:7
a fullcalendar.min.js:7
(anonymous function) fullcalendar.min.js:6
d jquery.min.js:3
n.event.dispatch jquery.min.js:3
r.handle
But because i was using Moment.min.js it was kinda hard to read where the problem was coming from, so i replaces Moment.min.js with Moment.js, and when the error popped up again i was able to read where the problem was:
months : function (m) {
return this._months[m.month()];
},
From what i gathered, m is undefined by the time this function is executed. Here is the code i used to post the new event data to the php script:
select:function(start, end, jsEvent, view){
CURRENT_SELECTION_START = start;
CURRENT_SELECTION_END = end;
console.log(CURRENT_SELECTION_START + '-' + CURRENT_SELECTION_END);
$.ajax({
url:'../AJAX/save_event.php',
type: 'POST',
data: {
Start_Time: start,
Event_Title: prompt('Title'),
End_Time: end
},
});
},
解决方案
I assume start is a moment-object.
I had the same problem and it seems: you can't send the moment-object, so you need to get the value as an integer or something else.
Try start.calendar()
or start.format("YYYY-MM-DD");
(or something similar) instead of start
.
worked for me, hopefully for you too ;)
Patrick