jQuery jsonP response headers

自古美人都是妖i 提交于 2019-12-10 07:20:41

问题


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?

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


回答1:


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.



来源:https://stackoverflow.com/questions/16408569/jquery-jsonp-response-headers

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!