我正在研究jQuery full calendar及其在Windows / Linux上的显示事件,如果我在iPad(Safari浏览器)上进行测试,则日历不显示事件。如果我点击任何日期,事件点击功能正常工作,但根本不显示事件。
这是我的代码:
var SITE_URL = 'MY_SITE_URL';
$(document).ready(function () {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek'
},
editable: true,
draggable: true,
dayClick: function (date, allDay, jsEvent, view) {
var myDate = new Date();
if (date.getDate() < myDate.getDate()) {
//TRUE Clicked date smaller than today
alert("You cannot book on this day!");
} else {
//dynamically load soloads which are not assigned to any date
var mmon = parseInt(date.getMonth() + 1);
var clicked_date = date.getDate() + '_' + mmon + '_' + date.getFullYear();
$('#get_selected_date').val(clicked_date);
$.ajax({
url: SITE_URL + 'member/getUserUnassignedAds',
type: 'POST',
success: function (data) {
$('#soloadsdropdown').html(data);
$('#addsoloadformlink').trigger('click');
}
});
}
},
events: function (start, end, callback) {
// on calendar loads this ajax runs
$.ajax({
url: SITE_URL + 'member/getUserAllAssignedAds',
success: function (doc) {
var doc = $.parseJSON(doc);
var events = [];
$(doc).each(function (i, val) {
events.push({
id: doc[i].id,
title: doc[i].title,
start: new Date(doc[i].start),
color: doc[i].color
});
});
callback(events);
}
});
},
eventDrop: function (event, dayDelta, minuteDelta, allDay, revertFunc) {
var dataString = 'assign_id=' + event.id;
$.ajax({
url: SITE_URL + 'member/checkIfAdIsOrdered',
type: 'POST',
data: dataString,
success: function (data) {
if (data != '0') {
if (data == 'mybought') {
alert("You cannot schedule bought ads!");
} else {
alert("You cannot rearrange sold ads!");
}
revertFunc();
} else {
if (!confirm("Do you really want to reschedule " + event.title + "?")) {
revertFunc();
} else {
var dataString = 'move_days=' + dayDelta + '&assign_id=' + event.id;
$.ajax({
url: SITE_URL + 'member/updateUserActiveAssignedAds',
type: 'POST',
data: dataString,
success: function (data) {
if (data == 'pastdate') {
alert("You cannot edit past date events!");
revertFunc();
} else if (data == 'notdone') {
alert("You cannot book on this day!");
revertFunc();
}
}
});
}
}
}
});
},
eventClick: function (event) {
var dataString = 'assign_id=' + event.id;
$.ajax({
url: SITE_URL + 'member/checkIfAdIsOrdered',
type: 'POST',
data: dataString,
success: function (data) {
if (data == 'pastdate') {
alert("You cannot edit past date events!");
} else if (data == 'reservedad') {
$('#clickreservebox').trigger('click');
$('#reservebox').show();
$('#unreservethisad').attr('rel', event.id);
} else {
if (data != '0' || data == 'mybought') {
$('#myOrderModal').html(data);
$('#clickorderconfirmbox').trigger('click');
$('#redirectbox').show();
} else {
$('#clickconfirmbox').trigger('click');
$('#confirmbox').show();
$('.pp-reserve-btn').attr('rel', event.id);
$('.pp-close-ii').attr('rel', event.id);
}
}
}
});
}
});
});
//At the end to make it real time i have added
$(document).ready(function(){
setInterval(function(){
$('#calendar').fullCalendar('refetchEvents');
}, 1000);
});
答案 0 :(得分:0)
说它没有填充,你的意思是没有加载任何事件吗?有一个类似的问题,这是因为后端的路径是MAC上的CASE SENSITIVE而不是Windows。因此,如果正确,请再次检查您的SITE_URL变量。
同样在Mac上你可以使用Safari来检查设备上可能存在的错误。 Take a look here获得教程