javascript - jquery: unable to print ajax response header (Jquery 1.7.1) -



javascript - jquery: unable to print ajax response header (Jquery 1.7.1) -

$.ajax({ async:false, type: 'post', url: itemurl, success: function(data,status,jqxhr) { responseobj = data; console.log('success function resp'); console.log(jqxhr.getallresponseheaders()); }, error: function(data){ responseobj = data; }, data:item, datatype: "json", });

here's code; unable print response headers; missing anything? prints out empty string.

tried using getresponseheader("location"), that's not working either; trying "location" header that's beingness returned ajax call.

however firbeug shows response headers including "location" after.

i using jquery 1.7.1

i worked @satish in helping reply question. cors issue, but, turns out there 2 issues involved here:

1) server needed add together 'location' access-control-expose-header response header, allows conforming xhr level-2 clients see header.

2) webkit clients had bug ignore access-control-expose-header when returning headers xhr response. fixed in webkit https://bugs.webkit.org/show_bug.cgi?id=76419, , verified it's working in safari based on webkit.

just add together background, request posting rest service create object. server response had status of 201 , stored location of new resource in 'location' header. cors request, xhr stripping 'location' header. adding header , upgrading version of webkit prepare corrected issue.

javascript jquery ajax json jquery-1.7

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -