Hi, I want to retrieve events from my calendar and display them on my website. I used this code which is mainly copied from the Google example:
<html> <head> <script type="text/javascript" src="http://www.google.com/jsapi"></ script> <script type="text/javascript"> google.load("gdata", "1"); </script> </head> <body> <script type="text/javascript"> /* * Retrieve events with a date query */ // Create the calendar service object var calendarService = new google.gdata.calendar.CalendarService ('GoogleInc-jsguide-1.0'); // The default "private/full" feed is used to retrieve events from // the primary private calendar with full projection var feedUri = 'http://www.google.com/calendar/feeds/info%40isa.de/ public/full'; // Create a CalendarEventQuery, and specify that this query is // applied toward the "private/full" feed var query = new google.gdata.calendar.CalendarEventQuery(feedUri); // All events in the future query.setFutureEvents(true); query.setOrderBy('starttime'); query.setSortOrder('ascending'); // The callback that will be called when getEventsFeed() returns feed data var callback = function(root) { // Obtain the array of matched CalendarEventEntry var eventEntries = root.feed.getEntries(); // If there is matches for the date query document.write("ok"); if (eventEntries.length > 0) { for (var i = 0; i < eventEntries.length; i++) { var event = eventEntries[i]; // Print the event title of the matches var times = event.getTimes()[0]; var start = times.getStartTime().getDate(); var endeTime = times.getEndTime().getDate().getTime() - 3600; var ende = new Date(endeTime); var sDate = start.getDate(); var eDate = ende.getDate(); var sMonth = start.getMonth() + 1; var eMonth = ende.getMonth() + 1; var sForm = (sDate < 10 ? '0' + sDate : sDate) + '.' + (sMonth < 10 ? '0' + sMonth : sMonth) + '.' + start.getFullYear(); var eForm = (eDate < 10 ? '0' + eDate : eDate) + '.' + (eMonth < 10 ? '0' + eMonth : eMonth) + '.' + ende.getFullYear(); document.write(sForm + ' - ' + eForm + ' ' + event.getTitle ().getText() + '<br />'); } } else { // No match is found for the date query document.write('no events are matched from the query!'); } } // Error handler to be invoked when getEventsFeed() produces an error var handleError = function(error) { document.write(error); } // Submit the request using the calendar service object. Notice the CalendarEventQuery // object is passed in place of the feed URI document.write("running"); calendarService.getEventsFeed(query, callback, handleError); document.write("ready"); </script> </body> </html> Everything works as expected in Firefox, Opera, Safari, Chrome, BUT in IE it does not work at all. The document.write() method inside the callback function doesn't do anything. It even doesn't give me the "ok" in line document.write("ok"); I also can't access any DOM-element with document.getElementById, seems that the document-Object is not present in the callback function. Can anyone help me with this? How can I pass data from the callback function to my web document? Regards, Haiko --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Calendar Data API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-calendar-help-dataapi?hl=en -~----------~----~----~----~------~----~------~--~---
