I'm performing a POST Method using JQuery
var params = JSON.stringify({ UserName: usr, Password: pwd });
var temp = $.ajax({
method: 'POST',
contentType: 'application/json',
url: 'some-url',
data: params,
dataType: 'json',
complete: function (data, textStatus, request) {
var ResponseCode = data.responseJSON.ResponseCode;
var ResponseMessage = data.responseJSON.ResponseMessage;
var TokenKey = data.responseJSON.TokenKey;
var UserName = data.responseJSON.UserName;
var type = data.responseJSON.Type;
if (ResponseCode == 100 && type == 1) {
window.open("page2.html", "_self");
}
else if (ResponseCode == 100 && type == 0) {
window.open("page1.html", "_self");
}
else if (ResponseCode != 100) {
alert(temp.getAllResponseHeaders);
}
},
error: function (data) {
alert("error")
}
});
now i can successfully find all the required data in the response body but there is some a specific header which i wish to put into a variable
i tried implementing the following lines withing the COMPLETE sector
var h = request.getHeader("Authorization-Token");
var h = request.getAllHeaders("Authorization-Token");
yet i'm always getting null or undefined Any help or suggestion is Much appreciated