0
永遠に再ロードし、それのない文書が存在しない:アヤックス(ajax.responseTextは)私はこれが起こっている理由を理解することはできません
<!DOCTYPE html>
<html>
<head>
<style>
</style>
</head>
<body>
<h1>HideSite</h1>
<script>
var ajax;
if (window.XMLHttpRequest) {
ajax = new XMLHttpRequest();
} else {
ajax = new ActiveXObject("Microsoft.XMLHTTP");
}
ajax.onreadystatechange = function() {
location.replace(ajax.responseText);
}
if (navigator.userAgent == 'code') {
ajax.open("POST", "location.txt", true);
ajax.send();
}
</script>
</body>
</html>
location.txtは、ファイルの場所が含まれていますが。
アップデート:代わりに、私はこれを挿入replace()
の
:alert(ajax.responseText)
。それは3回行い、ウィンドウには実際に何かが含まれていたのは3分の1でした。
if (ajax.responseText != undefined && ajax.responseText != "") {
alert(ajax.responseText);
}
私は追加すると、このことだけやって二回、onreadystatechange
イベントはAJAX呼び出しの寿命の間に複数回にヒットを取得します