0

我从 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 );
        }

但是没有添加事件。谁能帮我为什么不是?

4

1 回答 1

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);
                }
            });
        }
于 2013-11-29T12:14:50.793 回答