简体   繁体   中英

Google calendar feed not showing events

I have a public google calendar. The feed tests okay, but I can't get the events to show up in fullcalendar. My feed IS the XML feed for sharing. I've read similar posts but they didn't help.

http://drcraigjohnson.net/fullcalendar-1.5.3/demos/theme.html

$(document).ready(function() {
    var date = new Date();
    var d = date.getDate();
    var m = date.getMonth();
    var y = date.getFullYear();

    $('#calendar').fullCalendar({
        theme: true,
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        editable: true,                        
        events: 'https://www.google.com/calendar/feeds/jl2um2s9odbrtj7lt3bn9817vg%40group.calendar.google.com/public/basic',
        eventClick: function(event) {
            if (event.url) {
                window.open(event.url);
                return false;
            }
        },
    });
});

I was not able to test this with jsfiddle - I guess I don't have access to your Google Calendar. Anyway, a couple of things you might correct here:

  1. Remove the HTML comment from the JavaScript section! The one which starts with <!-- in the script tag
  2. You have an extra comma after the eventClick callback - remove that. That should have thrown a syntax error for you though. Your JS wont run with syntax errors.

Try checking your API calls with browser tools (Chrome Dev tools or Firebug) to debug further.

Oops! Make sure google calendar "Share only my free/busy information" is unchecked . Tested by using a known working feed, ie google holiday xml which worked. Then i knew it something re: my feed. Thanks again. Problem solved!!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM