2015-02-12 66 views
0
$.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] }); 
     }); 
    } 
}); 

以上是我的代碼,請任何人在代碼中找到我的錯。fullcalendar addEventSource不起作用

回答

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 
       } ] 
      }; 
     }); 
    } 
}); 

下一次在瀏覽器中檢查控制檯。