我从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 );
}
但没有添加事件。谁能帮我为什么不是?
我认为此代码会有所帮助:
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);
}
});
}