3
使用MySQL的Fullcalendar(資源分支)運行良好,插入。Fullcalendar - 如何立即將ID(從數據庫)進入事件?
然後移動&調整大小事件...但只有在頁面重新加載後。
我無法找到立即將db ID添加到事件的方式。結果是,當用戶創建一個事件並立即移動(或調整其大小)時,我無法更新數據庫。
我有mysql_insert_id回來了,似乎已經嘗試了一切,我知道得到它可用在那裏它需要的地方,可能是......
if (title) {
$.ajax({
type: "POST",
url: "db_actions.php",
data: {
equipment_id: resource.id,
start: start,
end: end,
title: title,
}
})
.done(function(id) {
alert("Resulting mysql_insert_id is " + id);
});
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allDay: allDay,
resource: resource.id,
event_id:id
},
true // make the event "stick"
);
有什麼想法?非常感激。
馬克
========================================= ====
更新...
啊哈!
一個簡單的答案...在回調內移動渲染器,允許訪問id變量。
if (title) {
$.ajax({
type: "POST",
url: "db_actions.php",
data: {
equipment_id: resource.id,
start: start,
end: end,
title: title,
}
})
.done(function(id) {
alert("Resulting mysql_insert_id is " + id);
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allDay: allDay,
resource: resource.id,
event_id:id
},
true // make the event "stick"
);
});