Hi, There could be other errors, but the first thing I notice is that you do not have an image in this page. An image loaded from the same domain is required to use the JS client, this is needed for crossdomain communication with JS. This is documented here -
http://code.google.com/apis/calendar/developers_guide_js.html#Authenticating You should use a debugger (Firebug for Firefox) to see what other JS errors are there if there are any Hope it helps, Austin On Mon, May 19, 2008 at 5:38 AM, tabetan <[EMAIL PROTECTED]> wrote: > > Hi, I have a problem inserting the event in the calendar? the code > seems to be correct to me. I am using javascript. > > > code--> > > <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <meta http-equiv="content-type" content="text/html; charset=utf-8"/ > > > <title>Insert Event</title> > <script type="text/javascript" > src="http://www.google.com/jsapi?key=In-The-Code-I-Tested-I-Have- > Put-The-Real-Key<http://www.google.com/jsapi?key=In-The-Code-I-Tested-I-Have-Put-The-Real-Key> > "> > </script> > <script type="text/javascript"> > <!-- > /* Loads the Google data JavaScript client library */ > google.load("gdata", "1"); > var calendarService; > var scope = "http://www.google.com/calendar/feeds"; > > function logMeIn() { > alert("logging in"); > var token = google.accounts.user.login(scope); > > } > function doLogout() { > scope = "http://www.google.com/calendar/feeds"; > if (google.accounts.user.checkLogin(scope)) { > google.accounts.user.logout(); > } > } > function initialize() { > calendarService = new > google.gdata.calendar.CalendarService('GoogleInc-jsguide-1.0'); > } > > // The callback method that will be called after a successful > insertion from insertEntry() > var callback = function(result) { > alert('event created!'); > } > > // Error handler will be invoked if there is an error from > insertEntry() > function handleError(error) { > alert(error); > } > > function insertEvent(){ > > // The default "private/full" feed is used to insert event > to the > // primary calendar of the authenticated user > var feedUri = ' > http://www.google.com/calendar/feeds/default/private/ > full'; > > // Create an instance of CalendarEventEntry representing the > new > event > var entry = new google.gdata.calendar.CalendarEventEntry(); > > // Set the title of the event > entry.setTitle(google.gdata.Text.create('JS-Client: insert > event')); > > // Create a When object that will be attached to the event > var when = new google.gdata.When(); > > // Set the start and end time of the When object > var startTime = > google.gdata.DateTime.fromIso8601("2008-03-10T09:00:00.000-08:00"); > var endTime = > google.gdata.DateTime.fromIso8601("2008-03-10T10:00:00.000-08:00"); > when.setStartTime(startTime); > when.setEndTime(endTime); > > // Add the When object to the event > entry.addTime(when); > > calendarService.insertEntry(feedUri, entry, callback, > handleError, > google.gdata.calendar.CalendarEventEntry); > } > > </script> > > </head> > <body onload="initialize()" onunload="GUnload()"> > <input type="button" id="logInOutBut" onclick="logMeIn();" > value="log > in"/> > <input type="button" id="logInOutBut" onclick="doLogout();" > value="log out"/> > <input type="button" id="insert" onclick="insertEvent();" > value="insert event"/> > </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 -~----------~----~----~----~------~----~------~--~---
