Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json 将google日历与fullcalendar集成_Json_Symfony_Fullcalendar_Google Calendar Api - Fatal编程技术网

Json 将google日历与fullcalendar集成

Json 将google日历与fullcalendar集成,json,symfony,fullcalendar,google-calendar-api,Json,Symfony,Fullcalendar,Google Calendar Api,我正在进行一个项目symfony3,将谷歌日历与fullcaldendar集成。我想用谷歌日历来显示我在谷歌日历中的所有事件,然后每次我在谷歌日历中更改事件时,它也会在谷歌日历中更改。因此,这一步是从googleCalendar获取google事件,我已经完成了,并尝试以json格式制作: $myjsonfile: [{ "title": "Rdv Ecole", "start": "2017-11-13T10:00:00+01:00", "end": "2017-11-13T12:00:00+

我正在进行一个项目symfony3,将谷歌日历与fullcaldendar集成。我想用谷歌日历来显示我在谷歌日历中的所有事件,然后每次我在谷歌日历中更改事件时,它也会在谷歌日历中更改。因此,这一步是从googleCalendar获取google事件,我已经完成了,并尝试以json格式制作:

$myjsonfile:

[{
"title": "Rdv Ecole",
"start": "2017-11-13T10:00:00+01:00",
"end": "2017-11-13T12:00:00+01:00"
 }, {
"title": "testing functions",
"start": "2017-11-20T13:15:00+01:00",
"end": "2017-11-20T14:15:00+01:00"
 }, {
"title": "another test",
"start": "2017-11-20T17:30:00+01:00",
"end": "2017-11-20T18:30:00+01:00"
 }, {
"title": "reuinion data vc",
"start": "2017-11-21T09:00:00+01:00",
"end": "2017-11-21T10:00:00+01:00"
 }]
因为我用的是symfony3,所以我做了一个

 return $this->render('calendar/loadcalendar.html.twig',['gevents'=>$myjsonfile]);
然后在我的页面中显示事件:

$(document).ready(function() {

        $('#calendar').fullCalendar({
            defaultView: 'agendaWeek',
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
            navLinks: true, // can click day/week names to navigate views
            selectable: true,
            selectHelper: true,
            select: function(start, end) {
                var title = prompt('Event Title:');
                var eventData;
                if (title) {
                    eventData = {
                        title: title,
                        start: start,
                        end: end
                    };
                    $('#calendar').fullCalendar('renderEvent', eventData, true); // stick? = true
                }
                $('#calendar').fullCalendar('unselect');
            },

            eventLimit: true, // allow "more" link when too many events
            eventSources: [
                {
                    url: "http://localhost/prog/web/app_dev.php/calendar/load",
                    dataType: "json",
                    method: 'GET'
                }
            ],
            eventClick: function(event) {

                var title = prompt('Change Event title:');
                event.title = title;
                $('#calendar').fullCalendar('updateEvent', event);

            }
        });

现在的问题是,我无法从我发送的json加载事件,所以有人能给我一些建议吗?谢谢在我的项目中,我是这样做的:

$('#calendar').fullCalendar({
    /* [...] */
    events: "{{ path('ajax_calendar_load') }}",
    /* [...] */
我的加载操作返回常规json:

    $response = new JsonResponse();
    $response->setContent($events);
    return $response;

你说“不能”是什么意思?您的事件源URL无效吗?当fullCalendar尝试调用它时会发生什么?控制台或浏览器中的网络选项卡中是否有错误?任何服务器错误?这不是错误,它显示它通过以下url捕获请求ajax: