fullcalendar addEventSource不起作用

时间:2015-02-12 07:51:05

标签: jquery fullcalendar

$.ajax({
    type: "GET",
    contentType: "application/json; charset=utf-8",
    url: "/Home/getEvents",
    dataType: "json",
    processData: true,               
    success: function (data) {                   
        $.each(data, function (i, li) {                       
            var source = {
                events: [
                    {
                        title:li.title,start:li.start,end:li.end,className:li.type
                    }
                ]
            };
            //$('#calen').fullCalendar('addEventSource', source);
            $('#Calendar').fullCalendar({ eventSources: [source] });
        });
    }
});

以上是我的代码,请任何人在该代码上找到我的错。

1 个答案:

答案 0 :(得分:0)

$.ajax({ 
    type: "GET", 
    contentType: "application/json; charset=utf-8", 
    url: "/Home/getEvents", 
    dataType: "json", 
    processData: true,
    success: function(){
       $.each(data, function (i, li) {
            var source = { 
                events: [ {
                    title:li.title,
                    start:li.start,
                    end:li.end,
                    className:li.type 
                } ] 
            };
      });
    }
 });

下次在浏览器中查看控制台。