私のajaxコードは次のとおりです。
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
alert(xhr.status);
if (xhr.status == 200) {
alert("200");
}
else if (xhr.status == 8001) {
alert("8001");
}
else if (xhr.status == 8000) {
alert("8000");
}
else if (xhr.status == 7000) {
alert("7000");
}
else {
alert("x");
}
}
};
xhr.open("POST","URL",true);
xhr.send(null);
xhr.openで対処したページのコードは次のとおりです。
if (request.getSession().getAttribute("SATI_UID") == null) {
response.sendError(8000);
} else {
response.sendError(8001);
}
firefox と chrome で動作しますが、サファリでは常にステータス 200 になります。サファリ 5.1.7 を使用しています。私もresponse.setStatus
代わりに使用していますresponse.sendError
が、機能していません。なぜこれが起こるのか誰か知っていますか?