Google Calendar API V3 and Ajax : No 'Access-C

2020-02-15 19:04发布

问题:

I'm getting lost with the new Google API V3 and JS calls (to perform Ajax requests).

After registering an app in the console, added access to Calendar API, setting API client ID and public API key, added the domains I want to use the app with, I tried this :

var feedurl = "https://www.google.com/calendar/feeds/8g7mhfnh0m4t0rrduvt01knnng%40group.calendar.google.com/public/basic?singleEvents=true&key=[MY_KEY]";
 $.get(feedurl,function(data){
    console.log(data);
});

But it returns :

XMLHttpRequest cannot load https://www.google.com/calendar/feeds/8g7mhfnh0m4t0rrduvt01knnng%40group.ca…public/basic?singleEvents=true&key=[MY_KEY]. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8888' is therefore not allowed access.

What did I forget ?