本文介绍了jQuery的JSONP响应头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道我可能会从一个JSONP请求的响应得到的头?这不支持文档没有具体提及,但 getReponseHeader 总是返回对我很感兴趣的是没可能当响应,以获得标头的请求头是一个脚本?

Does anyone know how I might get the headers from the response of a jsonp request? The docs don't mention specifically that this isn't supported, but getReponseHeader always returns null for the header I'm interested in. Is it not possible to get the headers for a request when the response is a script?

谷歌浏览器显示的标题回来的反应,但我不能从jqXHR对象,抓住它。

Google Chrome shows the header coming back with the response, but I just can't grab it from the jqXHR object.

推荐答案

没有,遗憾的是没有:因为该请求是使用执行<脚本> 标记中,浏览器一般不会给使用任何从JavaScript中的头。的jQuery创建的jqXHR对象没有任何方法来提取这些标题作为请求在技术上不是来自它。

No, unfortunately not: given that the request is executed using a <script> tag, the browser generally won't give access to any of the headers from JavaScript. The jqXHR object created by jQuery doesn't have any way to extract those headers as the request technically doesn't come from it.

这篇关于jQuery的JSONP响应头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 20:52