I am attempting to extract a cookie from an AJAX request to another server. I have some code running client side in a simple web app which you can see below.
I can verify that I receive a response from the server and my credentials are accepted. My question is: how do I extract the cookie from the response?
When I log the current value it returns null. I attempted to use the document.cookie attribute after looking around at other solutions online, but I don't think I'm doing this correctly.
function doLogin() {
$.ajax({
url: "https://servername.com/appserver/j_spring_security_check",
type: 'post',
async: true,
data: {
j_username: "uname",
j_password: "***********"
}
}).done(function(response) {
console.log("cookie : "+document.cookie)
});
};