jQueryAjax响应头从Echonest请求返回空字符串
我使用jQuery向Echonest发出Ajax请求,正如您可能知道的那样,Echonest返回一些头以查看速率限制。我尽我所能去读标题,但我找不到任何标题 这是我的代码:jQueryAjax响应头从Echonest请求返回空字符串,jquery,ajax,spotify,Jquery,Ajax,Spotify,我使用jQuery向Echonest发出Ajax请求,正如您可能知道的那样,Echonest返回一些头以查看速率限制。我尽我所能去读标题,但我找不到任何标题 这是我的代码: $.ajaxSetup({traditional:true, cache: false}); url = 'http://developer.echonest.com/api/v4/song/profile?api_key=' + api_key + '&callback=?'
$.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'))
});
这是响应的屏幕截图:
我正在尝试阅读X-Ratelimit-Limit
谢谢我很确定没有办法从jsonp请求中获取头,但该服务看起来像json,所以请改为执行json请求。很高兴知道,我不知道。我现在查一下。