jquery - Parse Error with an ajax call to Google Calendar API -
i'm trying call google calendar api. works api explorer fails javascript (jquery)
jquery.ajax({ url: "https://www.googleapis.com/calendar/v3/freebusy?key="+apikey, type: "post", datatype: "json", contenttype: "application/json", data: { "timemin": "2013-01-30t00:00:00.000z" } }) on api explorer returns error saying timemax missing (and it's ok)
"message": "missing timemax parameter." the ajax calls returns instead parse error, , don't understand why
"message": "parse error"
over year later, came across post. put parameters in url so. use jsonp , http because i'm doing simple parse of read calendar feed. use moment.js format times.
var https = 'https://www.googleapis.com/calendar/v3/calendars/' + calendarid + '/events? singleevents=true&orderby=starttime&sortorder=ascending&timemin=' + moment(startmin).format() + '&timemax=' + moment(startmax).format() + '&key=' + key; $.ajax({ url: https, datatype: 'jsonp', type: "get", success: function (response) { processfeed(response); } });
Comments
Post a Comment