2013-12-08 23 views
0

空字符串我正在阿賈克斯要求與jQuery的Echonest,正如你可能知道Echonest返回一些頭看到限速。我嘗試了一切我知道讀取標題,但我無法獲得任何標題。jQuery的Ajax響應頭部返回從Echonest要求

這是我的代碼:

$.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')) 
         }); 

這是響應的截圖:

enter image description here

我想讀X-Ratelimit限

謝謝

回答

1

我很確定沒有辦法從jsonp請求獲取標頭,但該服務看起來像json,所以請執行json請求。

+0

很高興知道,我不知道。我會現在檢查。 –