簡體   English   中英

除了內容類型和緩存控制之外,無法響應jquery getJson調用的標頭

[英]Unable to response headers from a jquery getJson call besides content-type and cache-control

我正在用這樣的jquery進行getJson調用

jQuery.getJSON("api.url.com/resource", function(result, status, hxr) {
  console.log(hxr.getAllResponseHeaders());
  console.log(hxr.getResponseHeader('link'));
});

我只想要hxr.getAllResponseHeaders()

content-type: application/json; charset=utf-8
cache-control: public, max-age=60, s-maxage=60

hxr.getResponseHeader('link')顯示為空,

獲取其他響應標頭時我在做什么錯這是我為請求獲取的所有標頭

Access-Control-Allow-Origin:*
cache-control:public, max-age=60, s-maxage=60
connection:close
content-length:8426
content-type:application/json; charset=utf-8
Date:Mon, 03 Mar 2014 23:38:22 GMT
etag:"c1b72eda189b91dd6ea837bd5e83c02a"
link:<http://api.url.com:80/v1/df?page=1>;rel="first">
Set-Cookie:connect.sid=s%3AG0eH5GaXlPq5Dc7onmNY3hGF.V%2Brv9d8DFjXXeI%2F5v9rATeTp%2FUcCxyPWScCDPiINJgY; Path=/; HttpOnly
status:200

附加說明:

  1. 這是一個跨域調用
  2. 我正在使用jQuery 1.11.0

您無法在跨域調用中訪問標頭信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM