javascript - FullCalendar js add event - Stack Overflow

I am trying to dynamicly add an event to my calendarFrom the documentation i have gathered the followin

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?

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?

Share Improve this question asked Aug 4, 2014 at 11:21 Marc RasmussenMarc Rasmussen 20.6k83 gold badges223 silver badges384 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

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);

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744763582a4592316.html

相关推荐

  • javascript - FullCalendar js add event - Stack Overflow

    I am trying to dynamicly add an event to my calendarFrom the documentation i have gathered the followin

    9天前
    70

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信