我使用Ajax在full-calender上加载所有事件,但问题events.push不起作用
$(function() {
var events = [];
$.ajax({
url: '/ajaxjson',
Type: 'GET',
dataType: 'json',
success: function(data) {
$.map(data, function(r) {
alert(r.libelle); //it's work
events.push({title: r.libelle,
start: r.date,
end: r.enddate});
});
},
error: function (error) {
alert('error :'+eval(error));
//alert('there was an error while fetching events!');
},
});
但events.push不起作用