I have a uri that is passed to me in a rest call that is is a redirect url and I want to be able to intercept the call to get the redirect 'location' in the header.
The following code returns null for the Location Header. What is the proper way to perform this client side?
$(document).ready(function () {
$.ajax({
url: 'http://myserver.com/redirect?token=AAAnY13Y-76LZ4zXDOd', // obviously not cross domain and contains redirect location to a youtube link to embed in my page, http://www.youtube.com/embed/bl2j345-xy
data: {
something: 'someotherthing'
},
complete: function (request, status) {
var location = request.getResponseHeader("Location"); // this is null...it shows up in Fiddler as http://www.myotherserver.com in the Location Header
},
error: function (request, error) {
alert(request.responseText);
}
});
});