Hi. Like so many others I'm having trouble inserting a new event into a calendar using JS. You can see my code below.
<html> <head> <script src="http://www.google.com/jsapi? key=ABQIAAAAvmfDj9xi_mQA3LRk0rFuoBQU3TkiSzOxCl8bKVp1wiXNlWX0EBRdoxc71M1xkPpQV03S3o91oJ73bw" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ google.load("gdata", "1"); google.setOnLoadCallback(init); function init() { logMeIn(); } function logMeIn() { scope = "http://www.google.com/calendar/feeds/"; if(google.accounts.user.checkLogin(scope)) { var token = google.accounts.user.login(scope); } } function handleError(e) { alert("There was an error!"); alert(e.cause ? e.cause.statusText : e.message); } function insertEntry() { logMeIn(); /* * Create a single event */ // Create the calendar service object var calendarService = new google.gdata.calendar.CalendarService('GoogleInc-jsguide-1.0'); // 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-05-10T09:00:00.000-08:00"); var endTime = google.gdata.DateTime.fromIso8601("2008-05-10T10:00:00.000-08:00"); when.setStartTime(startTime); when.setEndTime(endTime); // Add the When object to the event entry.addTime(when); // 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() // Submit the request using the calendar service object calendarService.insertEntry(feedUri, entry, callback, handleError, google.gdata.calendar.CalendarEventEntry); } //]]> </script> </head> <body> <img src="./pics/bg.gif" style="position:absolute; top: -1000px;"> </body> </html> The problem is when I call insertEntry, it comes back saying "response timed out", but about 75 % of the time it still inserts the new event. Any idea what is causing this? I can just stop prompting the errors, but since the event is not created every time, this is not a solution I can use. Thanks Jacob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
