[英]jQuery Ajax response header returns empty string from Echonest request
I am making Ajax request with jQuery to Echonest , as you might know Echonest returns some headers to see the rate limit. 我正在用jQuery向Echonest发出Ajax请求,因为您可能知道Echonest返回了一些标头以查看速率限制。 I tried everything I know to read headers but I couldn't get any header.
我尝试了所有我知道的读取标头的方法,但是我没有任何标头。
This is my code: 这是我的代码:
$.ajaxSetup({traditional:true, cache: false});
url = 'http://developer.echonest.com/api/v4/song/profile?api_key=' + api_key + '&callback=?';
var req = $.getJSON(url,
{
id : songID,
format: 'jsonp',
bucket:['audio_summary']
}).done(function(data, status, resp){
console.log(resp.getAllResponseHeaders())
console.log(resp.getResponseHeader('X-Ratelimit-Limit'))
});
And this is the screenshot of the response: 这是响应的屏幕截图:
I am trying to read X-Ratelimit-Limit 我正在尝试阅读X-Ratelimit-Limit
Thanks 谢谢
我很确定没有办法从jsonp请求中获取标头,但是该服务看起来像json,所以改为执行json请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.