我想使用 $.ajax 将创建的对象保存到 json-feed 文件中,但没有保存任何内容。该对象被放置在日历上,但是当我检查 .php 文件中的 JSON 提要时,什么都没有改变?
var calendar = $('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: ''
},
selectable: true,
selectHelper: true,
select: function(start, end) {
var title = prompt('Event:');
$.ajax({
url: "json-events.php",
type: 'POST',
data: {"foo": "bar"},
processData: false,
contentType: 'application/json'
});
if (title) {
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allday: false
},
true // make the event "stick"
);
}
calendar.fullCalendar('unselect');
},
editable: true,
events: "json-events.php",
eventDrop: function(event, delta) {
alert(event.title + ' was moved ' + delta + ' days\n' +
'would update json-feed here');
},