我从html中调用此函数:
AddEvent('2013-12-01T00:00:00Z', '2013-12-04T00:00:00Z');
这是我的功能:
function AddEvent(StartDate, EndDate){
$('#calendar').fullCalendar('renderEvent', {
id: StartDate,
title: '1',
start: StartDate,
end: EndDate,
allDay: true
}, true );
}
但是没有添加事件。任何人都可以帮助我,为什么不呢?
答案 0 :(得分:0)
我认为这段代码会有所帮助:
var initDrag = function (el) {
var eventObject = {
title: $.trim(el.text())
};
el.data('eventObject', eventObject);
el.draggable({ //ui
zIndex: 999,
revert: true,
revertDuration: 0
});
}
var addEvent = function (title,eventID) {
var html = $('<div class="external-event label" id="'+ eventID +'">' + title + '</div>');
jQuery('#event_box').append(html);
initDrag(html);
}
var eventCreate = function (title) {
$.ajax({
type : 'POST',
url : 'record.php',
data : {title : title},
dataType: 'JSON',
success : function(data){
var eventID = data.Id;
var eventTitle = data.title;
addEvent(eventTitle,eventID);
}
});
}