求大家指教
<script>
? ?var ds = document.getElementById("ds");
? ?var xhr = new XMLHttpRequest();
? ?xhr.open("get","file/zh.html?"+Math.random()*10000,true);
? ?xhr.send(null);
? ?xhr.onreadystatechange=function () {
? ? ? ?if (xhr.readyState==4&&xhr.status==200) {
? ? ? ? ? ?var x = xhr.responseText;
? ? ? ? ? ?console.log(x);
? ? ? ?}else{
? ? ? ? ? ?console.log(xhr.status);
? ? ? ?}
? ?}
</script>
為什么else中的語(yǔ)句總會(huì)執(zhí)行,而且還是兩次