我想獲取403禁止的錯誤的狀態,我可以用php curl來做到這一點,但需要使用jQuery來做到這一點。使用jquery獲取url狀態
這是我的代碼。
$.ajax({
url: 'https://s3.amazonaws.com/isdukg/01-jaimeson-complete_2_step_mix-pulse.mp3',
type: 'GET',
crossDomain: true,
dataType: 'jsonp',
statusCode: {
403: function() {
alert("Forbidden");
// or do something useful
}
}
});
$.ajax({
url: 'https://s3-eu-west-1.amazonaws.com/fkcreate/Angles%2C%20Circles%20and%20Triangles..%20Instrumental.mp3',
type: 'GET',
crossDomain: true,
dataType: 'jsonp',
statusCode: {
403: function() {
alert("Forbidden");
// or do something useful
}
}
});
其中一個網址,會產生一個403 Forbidden錯誤,你可以在這裏看到,如果你打開控制檯窗口並加載網頁 - http://scaredem.users36.interdns.co.uk/
我似乎無法抓住這個錯誤做一些有用的東西帶它。
直接在瀏覽器中打開該URL產生具有一個錯誤消息的XML文檔。 – 2012-04-20 10:50:31
我唯一得到的是'服務器不支持RFC 5746,請參閱CVE-2009-3555'。 – Armatus 2012-04-20 10:52:09