I am trying to use JQuery Full Calendar along with Spring MVC.
I have made a demo like that.
Target: I need to send the UPDATED calendar's data,after I enter my events, to the controller to handle it.
Issue: I've succeded to re-send the calendar I've inistialzed to the controller.
However,I can't send the updated calendar's data,after I enter my events, to the controller to handle it.
Freemarker:
<script type="text/javascript">
var calendar;
var calendarData;
function doAjax() {
var test = JSON.stringify(calendarData, censor(calendarData));
var x=$('#calendar').value;
$.ajax(
{
url:"[@spring.url '/vacation/setVacation'/]",
type: "POST",
data :x ,
dataType: "json",
contentType: "application/json"
});
}
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$.getJSON('[@spring.url '/vacation/getVacation'/]', function (data) {
calendar = $('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
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: allDay
},
true // make the event "stick"
);
}
calendar.fullCalendar('unselect');
},
editable: true,
events:data
});
calendarData = data;
});
});
</script>