views:

77

answers:

1

Hi SO

I'm having an issue with some missing http headers in a Ajax response. The ajax-page (.NET) adds som additional info to the http header by using Me.Response.AddHeader("ResponseCode", mResponseCode). If I access the ajax-page directly and use httpAnalyser to check the headers, I can see that the headers are added correctly. But when I call the Ajax page through jQuery, the headers are missing.

I'm puzzled. Anyone out there that can help me?

Best regards, Steffen

+1  A: 

In your complete or success method the first parameter is an XMLHttpRequest object that contains this information. You can retrieve any response header like this:

xmlHttpRequest.getResponseHeader('header-name');
Koen
@KoenYes - I know. But when I try that I get an empty string, because the header that I'm accessing is not present in the http header when I call the page through Ajax. It is however present if I access the Ajax page directly.
Steffen Jørgensen
You can also check the headers for AJAX calls with Firefox's Firebug add-in (using the Net tab). So you know if the header is really missing and if the problem is on the server or on the client.
Koen
The headers was not present, but it turned out that is was a problem elsewhere which cause the problem. But thanks for trying to help me out :-)
Steffen Jørgensen