且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jQuery-获取AJAX响应标头

更新时间:2022-03-03 22:46:30

为了与XMLHttpRequest向后兼容,将使用jqXHR对象 公开以下属性和方法: getAllResponseHeaders() getResponseHeader(). 从$ .ajax()文档中: http://api.jquery.com/jQuery.ajax/ >

For backward compatibility with XMLHttpRequest, a jqXHR object will expose the following properties and methods: getAllResponseHeaders() and getResponseHeader(). From the $.ajax() doc : http://api.jquery.com/jQuery.ajax/

对于jQuery> 1.3

For jQuery > 1.3

success: function(res, status, xhr) { 
  alert(xhr.getResponseHeader("myHeader"));
}