Google Calendar API V3 and Ajax : No 'Access-Control-Allow-Origin' header

喜你入骨 提交于 2019-12-18 09:37:49

问题


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 ?

来源:https://stackoverflow.com/questions/27151068/google-calendar-api-v3-and-ajax-no-access-control-allow-origin-header

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!