views:

2022

answers:

3

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 I try to view the header info with a javascript alert, it comes up null, even though firebug sees it correctly.

Here's the code, if it'll help:

$j.ajax({
   type: 'POST',
   url:'url.do',
   data: formData,
   complete: function(resp){
        alert(resp.getAllResponseHeaders());
        }
   });

I don't really have access to the server-side stuff in order to move the URL to the response body, which I know would be the easiest solution, so any help with the parsing of the header would be fantastic. Thank you for your time.

A: 

try this:

type: "GET",
async: false,
complete: function (XMLHttpRequest, textStatus) {
    var headers = XMLHttpRequest.getAllResponseHeaders();
}
cballou
Hmm. Thanks so much for the response, but that's still returning null. Any other ideas?
Shane
A: 

I have the same problem, any other ideas? Thanks

Octavio
+2  A: 
 var geturl;
  geturl = $.ajax({
    type: "GET",
    url: 'http://....',
    success: function () {
      alert("done!"+ geturl.getAllResponseHeaders());
    }
  });
keithics