我想获取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