Hi,

The problem I believe is that the code where you have to retrieve the list
of calendar is not being invoked.  The line

google.setOnLoadCallback(getMyFeed);

would have the flow of control of your script to invoke getMyFeed() soon as
the library is loaded, and within the getMyFeed method is where you want to
place the entire block of code to retrieve the list of calendars (instead
you have the logic to retrieve list of events).  Try this and let me know if
that helps.

Thanks,
Austin


On Wed, Jul 2, 2008 at 1:22 PM, NickP <
[EMAIL PROTECTED]> wrote:

>
> Hi All,
>
> I am trying to get my head around using javascript to retireve data
> from the google calendars. Admittedly Im not the strongest programmer
> in the world but I can always usually figure things out. I have read
> through the examples repeatidly and watched Austins videos many times
> but I just cant figure out what I am doing wrong. This is the simplest
> example below but I still cant figure it out. Could someone please
> tell me what Im doing wrong and give me any pointers they think might
> be of use. All I am trying to do is print out the names of all of my
> calenders and once I get this working im sure ill be able to complete
> more complicated examples.
>
> Many thanks.
>
> Nick.
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
> www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml";>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
> <title>Calender 1</title>
>
> <script type="text/javascript"
>  src="http://www.google.com/jsapi?
> key=ABQIAAAA_tPPv7USOeL................<http://www.google.com/jsapi?key=ABQIAAAA_tPPv7USOeL................>
> ..
> 4PSd0IR3IcjCcjFEBTXk9cpmq7R_lW3Bwc_-y0vjP28YA">
>
>
> </script>
>
> <script type="text/javascript">
>
> google.load("gdata", "1");
>
>
> google.setOnLoadCallback(getMyFeed);
>
>
> var myService;
> var feedUrl = "http://www.google.com/calendar/feeds/
> fashionz..............dgiant.co.uk/public/full";
>
> function setupMyService() {
>  myService =
>    new google.gdata.calendar.CalendarService('exampleCo-
> exampleApp-1');
> }
>
> function getMyFeed() {
>  setupMyService();
>
>  myService.getEventsFeed(feedUrl, handleMyFeed, handleError);
> }
>
> function handleMyFeed(myResultsFeedRoot) {
>  alert("This feed's title is: " +
>    myResultsFeedRoot.feed.getTitle().getText());
>
> }
>
> function handleError(e) {
>  alert("There was an error!");
>  alert(e.cause ? e.cause.statusText : e.message);
> }
>
>
> </script>
>
> <script type="text/javascript">
>
>
>
> /*
>  * Retrieve all calendars
>  */
>
> // Create the calendar service object
> var calendarService = new
> google.gdata.calendar.CalendarService('MyApp');
>
> // 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<http://www.google.com/calendar/feeds/default/allcalendars/full>
> ';
>
> //alert(feedUri);
>
> // 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();
>    PRINT('Calendar title = ' + calendarTitle);
>
>  }
> }
>
> //Error handler to be invoked when getAllCalendarsFeed() produces an
> error
> var handleError = function(error) {
>  PRINT(error);
> }
>
> // Submit the request using the calendar service object
> calendarService.getAllCalendarsFeed(feedUri, callback, handleError);
>
>
> </script>
>
> </head>
>
> <body>
>
> <img src="anything.gif" style="position: absolute; top:-1000px;" />
> </body>
> </html>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to