而不是警告(event.id +'被移动'+ delta +'days \ n'+'(应该更新你的数据库)');我需要打电话给我的createevent.php?id = $ id& start = $ star& end = $ end
我的json:
[{"id":"2","title":"hair cut Mike","start":"2013-02-02T13:30:00+01:00","end":"2013-02-02T15:30:00+01:00","color":"blue","allDay":false},{"id":"1","title":"hair cut Steve","start":"2013-02-02T09:30:00+01:00","end":"2013-02-02T10:30:00+01:00","color":"red","allDay":false}]
我也需要这个来创建新事件,我选择了jQuery然后工作(输入对话框)。
<script type='text/javascript'>
$(document).ready(function () {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
allDaySlot: true,
allDayText: 'Volledige dag',
firstHour: 8,
slotMinutes: 30,
defaultEventMinutes: 120,
axisFormat: 'HH:mm',
timeFormat: {
agenda: 'H:mm{ - h:mm}'
},
dragOpacity: {
agenda: .5
},
minTime: 0,
maxTime: 24,
selectable: true,
selectHelper: true,
select: function (start, end, allDay) {
var title = prompt('Event Title:');
if (title) {
calendar.fullCalendar('renderEvent', {
title: title,
start: start,
end: end,
allDay: false
},
true // make the event "stick"
);
}
calendar.fullCalendar('unselect');
},
events: "json-events.php",
eventDrop: function (event, delta) {
alert(event.id + ' was moved ' + delta + ' days\n' +
'(should probably update your database)');
},
timeFormat: 'H:mm',
loading: function (bool) {
if (bool) $('#loading').show();
else $('#loading').hide();
}
});
});
答案 0 :(得分:2)
只需在事件处理程序中使用记录良好的jQuery Ajax functions!
eventDrop: function (event, dayDelta, minuteDelta) {
// message to end user
alert(event.id + ' was moved ' + dayDelta + ' days\n' +
'- database will be updated now');
/**
* perform ajax call for db update
*/
jQuery.post(
'createevent.php'
, {
id: event.id
, start: event.start
, end: event.end
}
);
}
您还应该查看docu fullcalendars拖放回调