我正在使用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