I need to send to the servlet all events stored in the 'fullcallendar memory'. I know yet that fullcalendar has a callback that returns the array of all events:
$(#calendar).fullcalendar('clientEvents') -> Array[]
And I'm using a normal AJAX post to the servlet to send this array, for example:
var events = new Array();
events = JSON.stringify($(#calendar).fullcalendar('clientEvents'));
$.ajax(
{
async: false,
url: 'SaverServlet',
type: 'POST',
data: "eventsParameter="+events,
processData: false,
dataType: "json",
success: function () {
alert("ajax success");
},
error: function () {
debugger;
alert("ajax failure");
}
});
But all this miserably fails. I tried many ways without success. I think that the problem is the JSON.stringify(). I tried also to do this:
var events = new Array();
events = $(#calendar).fullcalendar('clientEvents');
$.ajax(
{
async: false,
url: 'SaverServlet',
type: 'POST',
data: "eventsParameter="+events,
processData: false,
dataType: "json",
success: function () {
alert("ajax success");
},
error: function () {
debugger;
alert("ajax failure");
}
});
But this all fails, the array reaches successfully the servlets but it seems to be unreadable or un unpareseable in JSON sense. Can someone help me?