gpt4 book ai didi

javascript - 完整日历删除数据库中外部事件的编辑描述

转载 作者:行者123 更新时间:2023-11-28 07:25:36 25 4
gpt4 key购买 nike

在完整日历外部拖动事件中,我想通过在复制事件时添加插入数据库中的事件 ID 和描述来更改描述。

 droppable: true, // this allows things to be dropped onto the calendar !!!
drop: function(date, allDay){ // this function is called when something is dropped
// retrieve the dropped element's stored Event Object
var originalEventObject = $(this).data('eventObject');
// we need to copy it, so that multiple events don't have a reference to the same object
var copiedEventObject = $.extend({}, originalEventObject);
// assign it the date that was reported
copiedEventObject.start = date;
copiedEventObject.description = 'custom_event';
copiedEventObject.allDay = allDay;
copiedEventObject.className = $(this).attr("data-class");
var new_date = copiedEventObject.start.format();
var new_event = copiedEventObject.title;
$.post('calendar_action.php',{'action':'create_event','date':new_date,'event':new_event},function(data){
$(copiedEventObject).attr("description",data);
});
// render the event on the calendar the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
$('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
$(this).remove();

},

最佳答案

ajax 中的 $.post 方法没有传递全局变量,所以我使用了 $.ajax 方法并且它工作正常

$.ajax({
type: 'POST',
async: false,
url: "calendar_action.php",
data: {'action':'create_event','date':new_date,'event':new_event},
success: function(data) {
desc = data;
}
});
copiedEventObject.description = desc+'_custom_event';

关于javascript - 完整日历删除数据库中外部事件的编辑描述,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29691714/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com