【发布时间】:2016-07-18 13:17:51
【问题描述】:
我正在尝试通过向linkedIn api 端点发出GET 请求来获取网站文章的分享数:
https://www.linkedin.com/countserv/count/share?url=http://stylehatch.co&format=json
这是我的代码:
$.ajax({
url: 'http://www.linkedin.com/countserv/count/share?url=http://stylehatch.co&format=json',
type: 'GET',
processData: false,
crossDomain: true,
contentType: "application/json",
jsonp: false,
success: function(data) { alert('succeeded'); },
error: function() { alert('Failed!'); },
});
当我运行它时,我得到:
XMLHttpRequest cannot load http://www.linkedin.com/countserv/count/share?url=http://stylehatch.co&format=json. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://aranca.craft.dev' is therefore not allowed access.`
我做错了什么?如何访问 sharedcount 数据?
【问题讨论】: