首页 > 解决方案 > Fullcalendar 不会加载事件

问题描述

我们正试图让 Fullcalendar 显示一些事件。我们从数据库的 ajax 调用中获取事件。然后在 ajax 成功处理程序中,我们将数组设置为 Fullcalendar 上的 events 属性

  $.ajax({
    type: 'GET',
    contentType: 'application/json',
    url: '/api/Bookings/' + sessionStorage.getItem("id"),
    success: function (eventsArr) {
        eventSources: [
            {
                events: eventsArr,
                color: 'blue',
                textColor: 'white'
            }
        ],

但是,事件不会显示在日历中。

返回的数组可能如下所示

[
{
    "title": "",
    "start": "2018-01-01T01:01:01",
    "description": "fefefefef"
},
{
    "title": "",
    "start": "2018-05-15T12:03:00",
    "description": "something"
},
{
    "title": "sfse Undervisning",
    "start": "2018-05-16T12:59:00",
    "description": "something2"
},
{
    "title": "Matematik",
    "start": "2018-05-17T12:30:00",
    "description": "2+2"
},
{
    "title": "Dansk",
    "start": "2018-05-18T13:00:00",
    "description": "Vikingtiden"
},
{
    "title": "test",
    "start": "2018-05-29T00:00:00",
    "description": "sefs"
},
{
    "title": "something",
    "start": "2018-05-30T00:00:00",
    "description": "sef"
}
]

标签: javascriptjsonajaxasp.net-mvcfullcalendar

解决方案


推荐阅读