I am just learning this myself, but I think you need to have an onLoad callback for google.load. Then do the rest of your logic after the callback has returned.
On Oct 15, 6:22 am, furby <[email protected]> wrote: > I have done this before and I know how to do this... But for some > reason I am being stupid today and can't do it. > > I am playing with the Calendar API. For some reason it will not work - > the error is "google.gdata is undefined"... But I am loading the > google jsapi file and loading gdata... The code I am using is pretty > much the example code : > > <script src="http://www.google.com/jsapi"></script> > <script> > google.load("gdata", "1.s"); > > // Create the calendar service object > var calendarService = new google.gdata.calendar.CalendarService > ('GoogleInc-jsguide-1.0'); > > // The default "allcalendars" feed is used to retrieve a list of > all > // calendars (primary, secondary and subscribed) of the logged-in > user > var feedUri = 'http://www.google.com/calendar/feeds/default/ > allcalendars/full'; > > // The callback method that will be called when getAllCalendarsFeed > () returns feed data > var callback = function(result) { > // Obtain the array of CalendarEntry > var entries = result.feed.entry; > for (var i = 0; i < entries.length; i++) { > var calendarEntry = entries[i]; > var calendarTitle = calendarEntry.getTitle().getText(); > alert('Calendar title = ' + calendarTitle); > } > } > > // Error handler to be invoked when getAllCalendarsFeed() produces > an error > var handleError = function(error) { > alert(error); > } > > // Submit the request using the calendar service object > calendarService.getAllCalendarsFeed(feedUri, callback, handleError); > > </script> > > Hello, world! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "iGoogle Developer Forum" 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-Gadgets-API?hl=en -~----------~----~----~----~------~----~------~--~---
