这是ajax代码,我怀疑资源部分,因为它在数组中有645个数据。当我放入少量静态数据时,它可以正常工作。 Chrome,firefox和safari仅在IE中运行,生成日历需要时间。 任何人都可以帮助我。
//get vehicle to calendar
$.ajax({
method: "GET",
url: '@Url.Action("WP", "WeeklyPlan")',
cache: false,
data: {
}, success: function (data) {
resource = []
events = []
var vehiclesWithReserations = data.vehicles;
if (vehiclesWithReserations == null) {
hideLoader();
toastr.warning(data.message);
return;
} else if (vehiclesWithReserations.length == 0) {
hideLoader();
}
var holidayList = data.holidays;
$.each(vehiclesWithReserations, function (i, v) {
resource.push({
id: v.FuhrparkFahrzeugID,
title: v.ModellName,
field: v.LocationId,
zuteilung: v.ZutName,
nvx: v.NVX
});
for (var q = 0; q < v.Reservations.length; q++) {
events.push({
id: v.Reservations[q].ReservationID,
resourceId: v.FuhrparkFahrzeugID,
start: moment(v.Reservations[q].DateFrom).toDate(),
end: moment(v.Reservations[q].DateTo).toDate()
})
}
});
generatecalender(holidayList);
}