PiRSquared17 / open-forum

Automatically exported from code.google.com/p/open-forum
0 stars 0 forks source link

Issue in Google calender api When loading #140

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I want to integrate google calender to add events from my site.

I have a mail id "hhhhh@gmial.com".I wnat to add event to google calender of 
this mail id.

How can i do this?

I only need javascriptinserting  not php inserting.

That means inserting values using php not needed .
I need only javascript code.

How can i do this?

When i using google code for this it is not working.

Displays error all time.This is the code i used:

    <html>
    <head>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">
     google.load("gdata", "1");
     google.setOnLoadCallback(getMyFeed);
    </script>   
    </head>
    <body>
    <script type="text/javascript">
     var myService;
     var feedUrl = "http://www.google.com/calendar/feeds/mariyadavis90@gmail.com/private/full";
     function logMeIn() {
       scope = "http://www.google.com/calendar/feeds/";
       var token = google.accounts.user.login(scope);
     }
     function setupMyService() {
       myService = new google.gdata.calendar.CalendarService('exampleCo-exampleApp-1');
       logMeIn();
     }
     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);
     }
     /*
      * 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("2010-03-10T09:00:00.000-08:00");
     var endTime = google.gdata.DateTime.fromIso8601("2010-03-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) {
       PRINT('event created!');
     }
     // Error handler will be invoked if there is an error from insertEntry()
     var handleError = function(error) {
       PRINT(error);
     }
     // Submit the request using the calendar service object
     calendarService.insertEntry(feedUri, entry, callback,handleError, google.gdata.calendar.CalendarEventEntry);

    </script>
     <form>
     <input type="button" value="Start" onClick="getMyFeed()" />
     </form>
    </body>
    </html>

Error:

    google.gdata is undefined
    [Break On This Error]   

    myService = new google.gdata.calendar.CalendarService('exampleCo-exampleApp-1')

    /test_cal/ (line 17)
    google.gdata is undefined
    [Break On This Error]   

    myService = new google.gdata.calendar.CalendarService('exampleCo-exampleApp-1')

Original issue reported on code.google.com by phpprogr...@gmail.com on 17 Feb 2012 at 12:17