jQuery.ajax()调用后,jqXHR.getAllResponseHeaders()不会返回所有头.服务器回应了以下标题:
Connection: keep-alive Content-Length: 64 Content-Type: application/json X-My-CustomHeader: whatever
getAllResponseHeaders()仅返回:
Content-Type: application/json
我究竟做错了什么?
例
var request = { 'url': 'http://api.someExternalDomain.com/resource/','type': someMethod,'success': function(data,textStatus,jqXHR) { console.log(jqXHR.getAllResponseHeaders()); } }; $.ajax(request);
从jquery官网:
原文链接:https://www.f2er.com/ajax/160074.htmlAt present,due to a bug in Firefox where .getAllResponseHeaders()
returns the empty string although .getResponseHeader(‘Content-Type’)
returns a non-empty string,automatically decoding JSON CORS responses
in Firefox with jQuery is not supported.