Saturday, June 1, 2024
40
rated 0 times [  42] [ 2]  / answers: 1 / hits: 5403  / 10 Years ago, mon, august 4, 2014, 12:00:00

I am trying to dynamicly add an event to my calendar



From the documentation i have gathered the following code:



    $.ajax({
type: 'POST',
url: '/Calendar/findEvents',
dataType: 'json',
data: {
request: 'ajax'
},
success: function (data)
{
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('.calendar').fullCalendar( 'renderEvent', event
[{
title: 'All Day Event',
start: new Date(y, m, d)
}]
);

}
});


However this does not seem to work.



i get the following error:



Uncaught TypeError: Cannot read property 'source' of undefined fullcalendar.min.js: 6


Can anyone tell me what i am missing or what i am doing wrong in order to add an event to my calendar?


More From » fullcalendar

 Answers
20

You should pass an object, and add true to fix the new event in the calendar :



var myevent = {title: 'All Day Event',start: new Date(y, m, d)};
$('.calendar').fullCalendar( 'renderEvent', myevent, true);

[#43366] Sunday, August 3, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
soniap

Total Points: 626
Total Questions: 119
Total Answers: 110

Location: Palestine
Member since Tue, Jul 20, 2021
3 Years ago
;