我正在使用fullcalendar,並且當我單擊日曆時我想保存事件。使用Ajax在Fullcallendar中保存事件
這就是我迄今爲止所使用的表單中提交的元素,但不是來自日曆,例如我無法獲取開始日期。
$('#calendar').fullCalendar({
...
select: function(start, end, allDay, event, resourceId) {
$('#add_appt').modal(); //openthemodal
$(document).ready(function(){
$('#EventAdd').submit(function(e) {
SubmitAppointment();
e.preventDefault();
});
});
function SubmitAppointment(){
hideshow('loading',1);
error(0);
$.ajax({
type: "POST",
url: "ajax.events.add.php",
// If I try this, I get all the elements of the form but no value for start I think it's my syntax that is wrong
data: $('#EventAdd').serialize(),start: start,
// If I try this, I get the start date but I don't know how to include the vales in EventAdd
data: 'start='+ start,
dataType: "json",
success: function(msg){
if(parseInt(msg.status)==1){
$('#add_appt').modal('hide');
//window.location=msg.txt;
}else if(parseInt(msg.status)==0){
error(1,msg.txt);
}
hideshow('loading',0);
}
});
}
有人可以幫我的語法嗎?因爲我認爲這就是問題所在。
是的,這是正確的做法!非常感謝你 ! – BAAC 2014-10-28 13:52:42
不客氣':)' – albciff 2014-10-28 14:06:43