2
votes

I'm using this jQuery Full Calendar:

http://arshaw.com/fullcalendar/

According to their documentation, I can load JSON event data and it will display accordingly.

http://arshaw.com/fullcalendar/docs/event_data/Event_Source_Object/

Here is what my ActionMethod is returning (obtained via Firebug):

[{"url":"/Eventos/Ver/1","start":1352073600,"end":1352074800,"title":"Evento #1"}]

I'm kind of stumped as to why the calendar won't load any of the events my code returns. Could it be because my JSON isn't formed the way the library expects it to? Any suggestions?

My server is returning a 200 OK server response so that's not an issue.

Here is the jQuery code I use to load the events:

<script language="javascript" type="text/javascript">
    $(document).ready(function () {
        $('#calendar').fullCalendar({
            // put your options and callbacks here
            events: '@Url.Action("GetEvents","Eventos")',
            header: {
                left: 'title',
                center: '',
                right: 'prev,next'
            },
            monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 
                         'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
            dayNames: ['Domingo', 'Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sabado'],
            dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab']
        });
    })
</script>
1
Any errors in the console? Add success and error handler for the ajax calls of the events and check the results.Andreas

1 Answers

1
votes

Your code works fine, and your JSON is in a proper format.

Are you sure you're looking at the right month? Your date converts to November 4th, 2012.

See this JSFiddle and navigate to November and you can see your event is displayed.

The difference is that the JSON feed in the example is specified directly in the events option, but if you already inspected it in Firebug then there shouldn't be a problem.