fullcalendar js: fetching more events with ajax

前端 未结 3 1174
时光取名叫无心
时光取名叫无心 2020-12-18 17:13

I\'m using fullcalendar, how can I fetch more events from same server side, multiple urls? The initial one works, I just want to add additional events when they arrive(ajax)

3条回答
  •  误落风尘
    2020-12-18 17:47

    You could use Ajax to get the data and then add dynamically the new source

    $.ajax({
      url: "test.html",
      success: function(data){
           var source = { events: [
                                {
                                    title: data.getTitle(),
                                    start: new Date(year, month, day)
                                }
                    ]};
                    $('#calendar').fullCalendar( 'addEventSource', source );
      }
    });
    

提交回复
热议问题