Will
Will

Reputation: 1622

jquery ajax: headers seem to not be working

i am trying to get the headers of an ajax request i made through jquery

 $.get(url, 
    function(response, textStatus, headers ) {
        console.log("Response: %o", response);
        console.log("TextStatus: %o", textStatus);
        console.log("Request: %o", headers);
    }
);

this does not seem to be working however:

the response and textstatus are printing, but the "headers" object seems to be undefined

i simply want to check if it is what i expect (content type='excel', etc) or if the response type is html, i can assume the page i was calling is an error

Upvotes: 1

Views: 775

Answers (1)

helloandre
helloandre

Reputation: 10721

that's because the jQuery.get() callback function doesn't have a third parameter. http://docs.jquery.com/Ajax/jQuery.get#urldatacallbacktype

Upvotes: 2

Related Questions