javascript - Get events from fullcalendar to display on google calendar -
currently, using fullcalendar adding events in web application.then want events in fullcalendar display in google calendar.
but have tried search , try this
i got error referenceerror: uicalendarconfig not defined
. don know how fix problem.i try find solution seems difficult.
my fullcalendar this:
$('#calendar').fullcalendar({ //.......... });
this code have tried:
<script type="text/javascript"> var clientid = '######', scopes = 'https://www.googleapis.com/auth/calendar', calendarid = '#####'; var apikey = '#####'; function handleclientload() { // step 2: reference api key gapi.client.setapikey(apikey); window.settimeout(checkauth,1); } //authorization in google function checkauth() { gapi.auth.authorize( { 'client_id': clientid, 'scope': scopes, 'immediate': true }, handleauthresult); } //checks if authorized function handleauthresult(authresult) { if (authresult && !authresult.error) { loadcalendarapi(); } else { handleauthclick(); } } //request credentials function handleauthclick() { gapi.auth.authorize( { client_id: clientid, scope: scopes, immediate: false }, handleauthresult); return false; } function loadcalendarapi() { gapi.client.load('calendar', 'v3', makeapicall); } // load api , make api call. display results on screen. function makeapicall() { requestlist = gapi.client.calendar.events.list({ 'calendarid': calendarid }); console.log('--- eventslist ---'); console.log(eventslist); //uicalendarconfig.calendars['mycalendar'].fullcalendar('removeeventsource', eventslist); $("#calendar").fullcalendar('removeeventsource', eventslist); eventslist = []; // step 6: execute api request requestlist .then(function (resp) { if (resp.result.error) { reporterror('google calendar api: ' + data.error.message, data.error.errors); } else if (resp.result.items) { resp.result.items.foreach(function (entry, index) { eventslist.push({ id: entry.id, title: entry.summary, start: entry.start.datetime || entry.start.date, // try timed. fall all-day end: entry.end.datetime || entry.end.date, // same //url: url, location: entry.location, description: entry.description }); }); } if (eventslist.length > 0) { //uicalendarconfig.calendars['mycalendar'].fullcalendar('addeventsource', eventslist, true); $("#calendar").fullcalendar('addeventsource', eventslist, true); } }, function (reason) { console.log('error: ' + reason.result.error.message); }); }
during trying code same events google calendar display in fullcalendar not same want. if know or have experiences this, me please.
thanks,
Comments
Post a Comment