I’m working with the fullcalendar jQuery plugin and I’m trying to populate my events by creating a JSON object on a jsp page.
Here is what I have for my fullcalendar code…
$('#mycalendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'agendaDay',
editable: false,
slotMinutes: 5,
allDaySlot: true,
lazyFetching: true,
eventSources: [
'/servlet/TEST?action=calendarData'
],
eventClick: function(event) {
if (event.url) {
window.location.href = event.url;
return false;
}
}
});
I know a lot of my parameters are set as the default, but I only have them set that way for debugging and they will be changed.
The request is going through and is returning what I’m expecting but the event is not getting displayed, which leads me to believe that I’m expecting the wrong thing. Which will probably be evident in my jsp page.
<%@ page contentType="application/json;" pageEncoding="UTF-8"%>
{
title: "test",
start: new Date(2011, 3, 12),
allDay: true
}
I’m just trying to hardcode a JSON object to the page so I can better understand what I will need to dynamically create for the real data. I’m expecting this to create an all day event for today. Firebug can read it as a JSON object… but the event is not displaying.
eventSourcesexpects valid JSON. The code that’s in your page is not valid JSON. All keys must be double-quoted, and Dates are not valid values as per the JSON grammar.Try this: