我已经使用full calendar外部拖动事件的主题分配接口。使用ajax更新主题的详细信息到MySQL数据库,但阿贾克斯不工作。我没有得到我的控制器中的值。检查其他问题,但没有找到解决办法。可以帮助吗?ajax不能使用完整的日历
$(document).ready(function() {
/* initialize the external events
-----------------------------------------------------------------*/
$('#external-events .fc-event').each(function() {
// create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
// it doesn't need to have a start or end
var eventObject = {
title: $.trim($(this).text()) // use the element's text as the event title
};
// store the Event Object in the DOM element so we can get to it later
$(this).data('eventObject', eventObject);
// make the event draggable using jQuery UI
$(this).draggable({
zIndex: 999,
revert: true, // will cause the event to go back to its
revertDuration: 0 // original position after the drag
});
});
/* initialize the calendar
-----------------------------------------------------------------*/
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
droppable: true,
drop: function(date,event) {
// retrieve the dropped element's stored Event Object
var originalEventObject = $(this).data('eventObject');
// we need to copy it, so that multiple events don't have a reference to the same object
var copiedEventObject = $.extend({}, originalEventObject);
// assign it the date that was reported
copiedEventObject.start = date;
// render the event on the calendar
// the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
$('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
// is the "remove after drop" checkbox checked?
if ($('#drop-remove').is(':checked')) {
// if so, remove the element from the "Draggable Events" list
$(this).remove();
}
$.ajax({
url: '/addSchedule',
dataType: 'json',
type: 'post',
data: {event: event},
success: function(response){
console.log('response');
}
});
}
});
});
2014-11-08
AVM
+0
'这不是working'不正确的问题陈述。什么不起作用以及您遵循了哪些故障排除步骤? –
2014-11-08 18:45:53
+0
@charlietfl在完整日历上发生拖放事件时使用ajax保存事件详细信息,但ajax调用失败。我没有获得控制器 –
2014-11-08 18:54:50
+0
@AVM中的值,您是否在控制台中看到错误?此外,如果您将'error:function(jqXHR,textStatus,errorThrown){console.log(jqXHR)}'([请参阅文档](http://api.jquery.com/jquery.ajax/))添加到您的$ ajax调用,你看到一条错误消息吗? –
2014-11-09 16:44:48