我一直在试图从蒸汽api中提取数据,并没有运气,因为我总是得到上述错误。这里是我使用的代码:跨域jquery ajax(Jsonp):未捕获SyntaxError:意外的令牌:(冒号)
var steamurl = "https://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/V001/?key=[keyomitted]&account_id=38440257&Matches_Requested=10";
function populate_api(){
var json;
$.ajax({
'url': steamurl,
'dataType': "jsonp",
'success': function (data) {
alert('success');
json = data;
}
});
}
我省略了我的API密钥。 我看了很多其他帖子,无法弄清楚问题出在哪里。我曾尝试使用Jsonp,普通的json,我也试过在steamurl
之后使用"&callback=?"
,但无济于事。
你可以共享服务器的响应格式吗 –
我不认为API支持JSONP,只有JSON。 – Barmar
请参见https://developer.valvesoft ware.com/wiki/Steam_Web_API/Feedback#API_Considerations_for_Web_Developers –