这就是我使用“事件源:”加载事件的方式:我有一个事件源数组:您有两种方法可以做到这一点:
1- JSON(更快,因为事件已经是 JSON 格式,无需迭代) 2- Ajax 调用(更慢,因为您必须在此处迭代 xml)
var othersources = {
jsonsource: {
url: ajaxcallURL(_url,"7"),
type: 'POST',
//error: function() { alert('something broke with courses...'); },
data:{
'func':func,
'year':y
},
cache: false,
color: '#C1272D',
textColor: 'white'
},
ajaxcallsource: {
events: function(start, end, callback) {
$.ajax({
type: 'POST',
url: ajaxcallURL(_url,"7"),
data: {
// our hypothetical feed requires UNIX timestamps
start: Math.round(start.getTime() / 1000),
end: Math.round(end.getTime() / 1000),
'func':func,
'year':y
},
success: function(doc) {
var events = [];
var allday = null; //Workaround
var Editable = null; //Workaround
$(doc).find('event').each(function()
{
if($(this).attr('allDay') == "false") //Workaround
allday = false; //Workaround
if($(this).attr('allDay') == "true") //Workaround
allday = true; //Workaround
if($(this).attr('editable') == "false") //Workaround
Editable = false; //Workaround
if($(this).attr('editable') == "true") //Workaround
Editable = true; //Workaround
events.push({
id: $(this).attr('id'),
title: $(this).attr('title'),
start: $(this).attr('start'),
end: $(this).attr('end'),
allDay: allday,
editable: Editable
});
});
callback(events);
}
});
},
cache: false,
//error: function() { alert('something broke with courses...'); },
color: '#C1272D',
textColor: 'white',
//className: 'course'
}
} //othersources array close
在日历属性中:
eventSources:[othersources.jsonsource,ajaxcallsource],
祝你好运