JSON无法通过网址

时间:2016-04-12 15:30:44

标签: javascript jquery json fullcalendar

我们正在尝试从网址加载我们的活动到完整日历,但事件不会加载。我在下面列出了JS,以及来自我们的URL / API的JSON响应 非常感谢!

URL / API JSON响应:

[{"start":"2016-04-012T15:30:00","end":"2016-04-12T16:30:00","title":"Calendar 1","allDay":"false","id":"a41380d1fbbaa819"}]

JS:

$(document).ready(function() {

    $('#calendar').fullCalendar({
        //theme: true,
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        defaultDate: moment().format("YYYY-MM-DD"),
        editable: true,
        events: {
            url: 'MY URL, I DIDN\'T POST IT HERE TO KEEP IT PRIVATE',
            error: function() {
                $('#script-warning').show();
            },
            success: function(){
                alert("successful: You can now do your stuff here. You dont need ajax. Full Calendar will do the ajax call OK? ");   
            }
        },
        loading: function(bool) {
            $('#loading').toggle(bool);
        }
    });

});

1 个答案:

答案 0 :(得分:0)

问题是日期格式:

[{"start":"2016-04-012T15:30:00","end":"2016-04-12T16:30:00","title":"Calendar 1","allDay":"false","id":"a41380d1fbbaa819"}]

根据ISO_8601日期" 2016-04-012T15:30:00"必须更改:" 2016-04-12T15:30:00"

有关详细信息,请参阅start parameter in Event_Object