使FullCalendar从嵌套的JSON结构中获取事件数据

时间:2012-07-11 15:31:00

标签: fullcalendar

我发送事件不是作为JSON数组,但是像这样:

{"result":"success",
                "events":[
                    {"end":"2012-07-14T11:00:00", "description":"1", "title":"2", "start":"2012-07-14T07:00:00"},
                    {"end":"2012-07-14T11:00:00", "description":"3", "title":"4", "start":"2012-07-14T07:00:00"}
                ]}

以这种方式从FullCalendar接收:

        events:{
            url:'/sweatiquette/calendar/events/',
            type:'POST',
            allDayDefault:false,
            data:{action:'get'}
        }

如果我使用这种结构发送数据,我想知道是否可以配置FullCalendar来处理来自“events”字段的数据。

1 个答案:

答案 0 :(得分:0)

使用http://arshaw.com/fullcalendar/docs/event_data/events_function/“事件作为函数”。 获取您的JSON对象并从那里解析events-array。