我有一个在休息调用中传递给我的 uri,它是一个重定向 url,我希望能够拦截调用以在标头中获取重定向“位置”。
以下代码为位置标头返回 null。执行此客户端的正确方法是什么?
$(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);
}
});
});