나는 인터페이스를 할당하는 주제에 대해 full calendar 외부 드래그 이벤트를 사용했습니다. 주제 세부 정보를 mysql db로 업데이트하는 데 사용 된 아약스이지만 Ajax가 작동하지 않습니다. 내 컨트롤러에서 값을 가져 오지 못했습니다. 다른 질문은 여기에 있지만 해결책을 찾지 못했습니다. 어떤 도움을 줄 수 있습니까?ajax가 전체 캘린더에서 작동하지 않습니다
<link href='assets/fullcalendar/fullcalendar.css' rel='stylesheet' />
<link href='assets/fullcalendar/fullcalendar.print.css' rel='stylesheet' media='print' />
<script src='assets/fullcalendar/lib/moment.min.js'></script>
<script src='assets/js/jquery.js'></script>
<script src='assets/fullcalendar/lib/jquery-ui.custom.min.js'></script>
<script src='assets/fullcalendar/fullcalendar.min.js'> </script>
<script>
$(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');
}
});
}
});
});
</script>
'작동하지 않습니다.'는 적절한 문구가 아닙니다. 작동하지 않는 기능과 수행 한 문제 해결 단계는 무엇입니까? – charlietfl
@charlietfl 전체 일정에서 놓기 이벤트가 발생했지만 아약스 호출이 실패하면 아약스를 사용하여 이벤트 세부 정보를 저장합니다. 컨트롤러 – AVM
@AVM의 값을 가져 오지 못했습니다. 콘솔에 오류가 표시됩니까? 또한,'error : function (jqXHR, textStatus, errorThrown) {console.log (jqXHR)}'([문서보기] (http://api.jquery.com/jquery.ajax/))를 $ ajax 호출, 오류 메시지가 보입니까? –