jQuery and AJAX response header

前端 未结 8 2401
夕颜
夕颜 2020-11-22 10:45

So I\'ve got this jQuery AJAX call, and the response comes from the server in the form of a 302 redirect. I\'d like to take this redirect and load it in an iframe, but when

8条回答
  •  清酒与你
    2020-11-22 10:57

    cballou's solution will work if you are using an old version of jquery. In newer versions you can also try:

      $.ajax({
       type: 'POST',
       url:'url.do',
       data: formData,
       success: function(data, textStatus, request){
            alert(request.getResponseHeader('some_header'));
       },
       error: function (request, textStatus, errorThrown) {
            alert(request.getResponseHeader('some_header'));
       }
      });
    

    According to docs the XMLHttpRequest object is available as of jQuery 1.4.

提交回复
热议问题