简体   繁体   English

除了内容类型和缓存控制之外,无法响应jquery getJson调用的标头

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

I'm doing a getJson call with jquery like this 我正在用这样的jquery进行getJson调用

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

I'm only getting for hxr.getAllResponseHeaders() 我只想要hxr.getAllResponseHeaders()

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

hxr.getResponseHeader('link') is showing null, hxr.getResponseHeader('link')显示为空,

What am I doing wrong to get the other response headers This are all the headers that I'm getting for the request 获取其他响应标头时我在做什么错这是我为请求获取的所有标头

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

Aditional Notes: 附加说明:

  1. This is a cross-domain call 这是一个跨域调用
  2. I'm using jquery 1.11.0 我正在使用jQuery 1.11.0

您无法在跨域调用中访问标头信息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 根据 CORS 预检响应中的 header 'Access-Control-Allow-Headers' 不允许使用 'content-type' - ‘content-type’ is not allowed according to header ‘Access-Control-Allow-Headers’ from CORS preflight response 如何使用 Fetch 从响应标头中获取内容类型 - How to get content-type from the response headers with Fetch CORS:飞行前响应中Access-Control-Allow-Headers不允许Content-Type - CORS: Content-Type is not allowed by Access-Control-Allow-Headers in preflight response 预检响应中的 Access-Control-Allow-Headers 不允许内容类型 - content-type is not allowed by Access-Control-Allow-Headers in preflight response 从响应中解析缓存控制标头值 - Parsing cache-control header value from response 解决矛盾的Cache-Control标头 - Resolving contradictory Cache-Control headers Slack 传入 webhook:预检响应中的 Access-Control-Allow-Headers 不允许请求标头字段 Content-type - Slack incoming webhook: Request header field Content-type is not allowed by Access-Control-Allow-Headers in preflight response CI和Angular4:在飞行前响应中,Access-Control-Allow-Headers不允许请求标头字段的内容类型 - CI and Angular4 : Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response 被 CORS 策略阻止:预检响应中的 Access-Control-Allow-Headers 不允许请求标头字段内容类型 - blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response React.js + PHP/Apache:预检响应中的 Access-Control-Allow-Headers 不允许请求标头字段内容类型 - React.js + PHP/Apache: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM