My post method is something like this:
public HttpResponseMessage AddUser(User user)
{
UserManager userManager = new UserManager();
t
According to the documentation, the headers object is actually a function that returns the header, like so:
.success(function(data, status, headers, config) {
alert( headers('Location') );
});
If you want a collection of all headers, you can do this:
.success(function(data, status, headers, config) {
console.log( headers() );
});
Note: If your server sets a response code of 301 or 302, you will not be able to get the Location header, as it will be automatically and transparently followed by the XMLHttpRequest object.
So, make sure you are correctly setting the response code. I was testing this in PHP (which I don't use as much), and had forgotten that setting a Location header automatically set the response code. To test this, I had to use:
header('Location: blah-blah', true, 200);
Here's my working code sample, just save it to location-test.php on a PHP server and run it:
$_GET['q']));
} else {
?>
Location Header: {{loc}}