使用jquery FullCalendar的多个事件源

我知道有一些如何使用FullCalendar使用多个feed源的例子,即: Stackoverflow post

插件文档

但是,它们都没有显示如何使用多个feed源以及类型,数据等其他ajax信息。

我正在尝试使用多个Feed源但无法使其工作。 这是我的代码:

eventSources: [ 'json-schedule.php', 'json-events.php' ], type: 'POST', data: { // custom_param1: 'something', }, error: function() { alert('there was an error while fetching events!'); }, success: function() { }, 

类型,数据,错误和成功部分在哪里与多个数据源一起使用? 我发现的所有例子都没有显示出来。

试试这种方式:

 $('#calendar').fullCalendar({ ... eventSources: [ // your JSON event source { url: '/myfeed.php', // use the `url` property color: 'yellow', // an option! textColor: 'black' // an option! }, // your ajax event source { events: function(start, end, callback) { $.ajax({ url: 'myxmlfeed.php', dataType: 'xml', data: { // our hypothetical feed requires UNIX timestamps start: Math.round(start.getTime() / 1000), end: Math.round(end.getTime() / 1000) }, success: function(doc) { var events = []; $(doc).find('event').each(function() { events.push({ title: $(this).attr('title'), start: $(this).attr('start') // will be parsed }); } }); } } ], ... }); 
  eventSources: [ { url: 'json-schedule.php', type: 'POST', data: { date: start, //data to be sent custom_param2: 'somethingelse' }, error: function() { alert('there was an error while fetching shedule!'); }, color: 'yellow', // a non-ajax option textColor: 'black' // a non-ajax option }, { url: 'json-events.php', type: 'POST', /*data: { custom_param1: 'something', custom_param2: 'somethingelse' },*/ error: function () { alert('there was an error while fetching events!'); }, color: 'green', // a non-ajax option textColor: 'black' // a non-ajax option } ], 

我的方法有点不同,添加多个事件源但工作正常。

  var fcSources = { loadEvents: { url: "/get-all-events-from-mysql", type: "GET", color: "#65a9d7", textColor: "#3c3d3d", cache: true, className: "events", data: { start: "start", end: "end", id: "id", title: "title" }, error: function() { console.log("Error in loadEvents: " + data); }, }, loadEwsEvents: { url: "/get-ews-events", type: "GET", color: "#FF6347", textColor: "#000000", cache: true, editable: false, disableDragging: true, className: "events", data: { start: "start", end: "end", id: "id", title: "title" }, error: function() { console.log("Error in loadEWSEvents: " + data); }, } }; 

//在fullcalendar函数中添加这些源

  eventSources: [ fcSources.loadEvents, fcSources.loadEwsEvents ],