Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.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
无法使用fullcalendar从google日历检索事件_Calendar_Fullcalendar - Fatal编程技术网

无法使用fullcalendar从google日历检索事件

无法使用fullcalendar从google日历检索事件,calendar,fullcalendar,Calendar,Fullcalendar,我跟着图图看亚当·肖的完整日历,我无法从谷歌日历中检索事件。这是我的密码: <!DOCTYPE html> <html> <head> <link href="<?php echo css_url().'fullcalendar.css'; ?>" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="<

我跟着图图看亚当·肖的完整日历,我无法从谷歌日历中检索事件。这是我的密码:

 <!DOCTYPE html>
    <html>
    <head>
    <link href="<?php echo css_url().'fullcalendar.css'; ?>" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="<?php echo js_url().'jquery.js'; ?>"></script>
    <script type="text/javascript" src="<?php echo js_url().'fullcalendar.js'; ?>"></script>
    <script type='text/javascript' src='fullcalendar/gcal.js'></script>


    <script type='text/javascript'>

    $(document).ready(function() {

    // page is now ready, initialize the calendar...

    $('#calendar').fullCalendar({
        // put your options and callbacks here
    })

    });


    $(document).ready(function() {

      $('#calendar').fullCalendar({
          events: $.fullCalendar.gcalFeed(
             "http://www.google.com/calendar/feeds/username%40gmail.com/public/basic") 

    });

    });

    </script>

</head>
<div id='calendar'></div>
</html


您应该只实例化FullCalendar一次。用此替换脚本标记,它应该可以工作:

<script type='text/javascript'>
    $(document).ready(function() {
      $('#calendar').fullCalendar({
          events: $.fullCalendar.gcalFeed(
             "http://www.google.com/calendar/feeds/username%40gmail.com/public/basic") 
      });
    });
</script>

$(文档).ready(函数(){
$(“#日历”).fullCalendar({
事件:$.fullCalendar.gcalFeed(
"http://www.google.com/calendar/feeds/username%40gmail.com/public/basic") 
});
});
让我知道这是否有帮助


编辑:小提琴-。另外,请确保
gcal.js
路径正确,并且包含在HTML中

为什么有2个
$(document).ready()
函数?此外,您似乎两次初始化完整日历-这只是复制/粘贴中的错误吗?此外,指向日历的链接无效@ganeshk,谢谢你的回答,我是JQuery的新手。在我的代码中,我用gmail上的用户名替换用户名。我检查了它。我删除了第二个$(document).ready()。因此,我的代码类似于$(document).ready(function(){$('#calendar').fullCalendar({//put your options and callbacks here})$('#calendar').fullCalendar({events:$.fullCalendar.gcalFeed(“)});虽然我在谷歌上创建了一些活动,但它显示了一个空日历calendar@ganeshk,我还尝试了这个$(document).ready(function(){var source={url:'};$('#calendar').fullCalendar('addEventSource',source);});但它仍然不起作用它给我一个没有任何日历的白页它给我一个没有任何日历的白页-你的谷歌日历是公共的吗?你在浏览器控制台中看到任何错误吗?是的,它是公共的。你可以检查[链接]().我的浏览器控制台中没有错误检查这把小提琴-。它对我有效。你能检查你是否包含gcal.js并且它在正确的路径中吗?