我想尝试从 API 获取数据,但我得到了
请求的资源上不存在“Access-Control-Allow-Origin”标头。因此,Origin 'null' 不允许访问。
我无法更改 API 的内容,所以我无法使用JSONP
到目前为止,这些都是我尝试过的:
$.getJSON('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v2/?key=keyhere&format=json&steamids=76561197970938759', function(data) {
console.log(data);
});
$.get("http://www.api.steampowered.com/ISteamUser/GetPlayerSummaries/v2/?key=keyhere&format=json&steamids=76561197970938759", function(data) {
console.log(data);
});
$.ajax({
type: 'GET',
url: 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v2/?key=keyhere&format=json&steamids=76561197970938759',
dataType: "json",
success: function(data) {
console.log(data)
}
});