저는 리디렉션 URL 인 나머지 전화에서 저에게 전달되는 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);
}
});
});
가능한 복제본 [jQuery Ajax 호출 후 리디렉션 요청을 관리하는 방법] (http://stackoverflow.com/questions/199099/how-to-manage-a-redirect-request-after-a-jquery- ajax-call) 관련 항목 : http://stackoverflow.com/q/282429/995876 – Esailija
나는 그것이 단지 나를위한 것이지 모르겠지만'status' ='error'. 이것이 응답 헤더가없는 이유 일 수 있습니까? – Nope
@ FrançoisWahl : 사실입니다. 방금 확인했는데 상태가 잘못되었습니다. 전에는 작동했지만 틀렸을지라도 request.responseText는 비어 있습니다. – JaJ