大家好我想要寫的我工作的公司一個PHP內部網發佈,但我已經打到這個問題一堵牆:Fullcalendar - 阿賈克斯不是在IE8
IE8的用戶,當他們通過添加事件點擊它提問所有問題的日子,但不會在MySQL數據庫中發佈任何內容,但它會在後續的IE,FF和Chrome上發佈。
下面的代碼
$(document).ready(function() {
var user = '<?php echo $_SESSION['user_token'][0]; ?>';
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $('#calendar').fullCalendar({
editable: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
events: "../../web_assets/calendar/events.php",
data: 'user='+user ,
type: "POST",
// Convert the allDay from string to boolean
eventRender: function(event, element, view) {
if (event.allDay === 'true') {
event.allDay = true;
} else {
event.allDay = false;
}
},
selectable: true,
selectHelper: true,
// Add event to Calendar
select: function(start, end, allDay) {
var title = prompt('Event Title:');
var url = prompt('Type Event url, if exits:');
if (title) {
start = $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss");
end = $.fullCalendar.formatDate(end, "yyyy-MM-dd HH:mm:ss");
$.ajax({
url: '../../web_assets/calendar/add_events.php',
data: 'title='+ title +'&owner='+ user +'&start='+ start +'&end='+ end +'&url='+ url ,
type: "POST",
success: function(json) {
alert('Added Successfully');
}
});
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allDay: allDay
},
true // make the event "stick"
);
}
calendar.fullCalendar('unselect');
},
// Update Event on Calendar (Move Item)
editable: true,
eventDrop: function(event, delta) {
start = $.fullCalendar.formatDate(event.start, "yyyy-MM-dd HH:mm:ss");
end = $.fullCalendar.formatDate(event.end, "yyyy-MM-dd HH:mm:ss");
$.ajax({
url: '../../web_assets/calendar/update_events.php',
data: 'title='+ event.title+'&start='+ start +'&end='+ end +'&id='+ event.id ,
type: "POST",
success: function(json) {
alert("Updated Successfully");
}
});
},
// Event update (resize event)
eventResize: function(event) {
start = $.fullCalendar.formatDate(event.start, "yyyy-MM-dd HH:mm:ss");
end = $.fullCalendar.formatDate(event.end, "yyyy-MM-dd HH:mm:ss");
$.ajax({
url: '../../web_assets/calendar/update_events.php',
data: 'title='+ event.title+'&start='+ start +'&end='+ end +'&id='+ event.id ,
type: "POST",
success: function(json) {
alert("Updated Successfully");
}
});
}
});
});
如果有人能排序了這一點,你會成爲我的一天......
編輯
我讓你們建議的修改,請你能告訴我爲什麼更新事件不起作用? 如果需要,我可以發佈php PDO mysql語句...?
Internet Explorer對JavaScript中的拼寫錯誤非常敏感,而其他瀏覽器可能會忽略任何小的拼寫錯誤。所以仔細檢查你的代碼,它可能只是一個缺失的分號或逗號。 –