brad
brad

Reputation: 32345

jQuery jsonP response headers

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.

Upvotes: 4

Views: 1451

Answers (1)

Femi
Femi

Reputation: 64700

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.

Upvotes: 4

Related Questions