Events not displayed in fullcalendar js

asp.net, fullcalendar, jquery

Solution

Calendar needs to be told to update after a data change. Try:

$("#calendar").fullCalendar('removeEvents');
$("#calendar").fullCalendar('addEventSource', nevent);
$("#calendar").fullCalendar('rerenderEvents');

when nevent is ready.

EDIT:

Accept the input as JSON object not a string:

nevent = $.parseJSON(document.getElementById('<%=hdnevent.ClientID%>').value);

Note that the JSON must be in correct format with quotes like:

[{ "id": "2302", "title": "XXX", "start": "4/4/2014 12:00:00 AM", "end": "4/4/2014 12:00:00 AM", "allDay": true, "url": "xxx"}]

Problem

Please any one help me to find what is going wrong in code. I used fullcalendar.js for calendar event. I want to show the events in calendar. below is my code. ``` $(document).ready(function() { $(window).resize(function() { $('#calendar').fullCalendar('option', 'height', get_calendar_height()); }); var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); var nevent = []; nevent = document.getElementById('<%=hdnevent.ClientID%>').value; // alert(nevent); var calendar = $('#calendar').fullCalendar({ theme: true, header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay', width: get_calendar_width }, width: get_calendar_width, height: 480, selectable: true, selectHelper: true, slotMinutes: 15, allDayDefault: false, // events: 'JsonResponse.ashx', events: nevent }); }); ``` `nevent` value is: ``` [{ id: '2302', title: 'XXX', start: '4/4/2014 12:00:00 AM', end: '4/4/2014 12:00:00 AM', allDay: true, url: 'xxx'}] ``` but it is not displayed in calendar. if i gave directly assign the value then it displaying the event. Example: ``` events: [ { id: '2302', title: 'XXX', start: '4/4/2014 12:00:00 AM', end: '4/4/2014 12:00:00 AM', allDay: true, url: 'xxx' } ] ``` pls kindly help me to rectify my error.

Original source