2016-09-27 3 views
1

안녕하세요, xhttp.send(); 계속 돌아 오는 중한 페이지에 여러 개의 xhttp.sends가 있습니다.

net::ERR_EMPTY_RESPONSE 

내 코드는 다음과 같습니다. 사용자가 너무 빨리 누르려고하면 페이지에서 벗어납니다. 이걸 막을 방법이 있니? 나는 거의 모든 php.ini의 설정 필자에 대해 장난 해봤

document.domain = "bitcoinrpg.com"; 

function UsernameTaken(name) { 
    var xhttp; 
    if (window.XMLHttpRequest) { 
    xhttp = new XMLHttpRequest(); 
    } else { 
    xhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
    } 
    if (name == "") { 
    document.getElementById("UsernameTaken").innerHTML = ""; 
    return; 
    } 
    xhttp.onreadystatechange = function() { 
    if (this.readyState == 4 && this.status == 200) { 
     document.getElementById("UsernameTaken").innerHTML = this.responseText; 
    } 
    }; 
    xhttp.open("GET", "CheckUsername.php?q=" + name, true); 
    xhttp.send(); 
} 

function BattlePlayers() { 
    var xhttp; 
    if (window.XMLHttpRequest) { 
    xhttp = new XMLHttpRequest(); 
    } else { 
    xhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
    } 
    xhttp.onreadystatechange = function() { 
    if (this.readyState == 4 && this.status == 200) { 
     document.getElementById("BattleTable").innerHTML = this.responseText; 
    } 
    }; 
    xhttp.open("POST", "GetPlayers.php?", true); 
    xhttp.send(); 
    PlayerInfo(); 
} 

function PlayerInfo() { 
    var xhttp; 
    if (window.XMLHttpRequest) { 
    xhttp = new XMLHttpRequest(); 
    } else { 
    xhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
    } 
    xhttp.onreadystatechange = function() { 
    if (this.readyState == 4 && this.status == 200) { 
     document.getElementById("CharacterBar").innerHTML = this.responseText; 
    } 
    }; 
    xhttp.open("POST", "PlayerInfo.php?", true); 
    xhttp.send(); 
} 

function FightPlayer(enemyName) { 
    var elements = document.getElementsByClassName("BattleButton"); 
    for (var i = 0; i < elements.length; i++) { 
    elements[i].setAttribute("disabled", "disabled"); 
    } 
    var xhttp; 
    if (window.XMLHttpRequest) { 
    xhttp = new XMLHttpRequest(); 
    } else { 
    xhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
    } 
    xhttp.onreadystatechange = function() { 
    if (this.readyState == 4 && this.status == 200) { 
     document.getElementById("battlestatus").innerHTML = this.responseText; 
     BattlePlayers(); 
    } 
    }; 
    xhttp.open("GET", "FightPlayer.php?enemyname=" + enemyName, true); 
    xhttp.send(); 
} 

function InventoryShow() { 
    var xhttp; 
    if (window.XMLHttpRequest) { 
    xhttp = new XMLHttpRequest(); 
    } else { 
    xhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
    } 
    xhttp.onreadystatechange = function() { 
    if (this.readyState == 4 && this.status == 200) { 
     document.getElementById("InventoryTable").innerHTML = this.responseText; 
    } 
    }; 
    xhttp.open("POST", "PlayerInventory.php?", true); 
    xhttp.send(); 
} 

각 기능 그냥 같은 반환 때마다 각 xhttp 변수의 이름을 변경했습니다. 당신은 같은 일을 경험하는 사람은 여기

enter image description here

+0

'BattlePlayers()'의 콜백 함수에서 'PlayerInfo()'를 호출해야하므로 전투가 완료 될 때까지 플레이어 정보를 업데이트하지 않습니다. – Barmar

+0

참조 http://stackoverflow.com/questions/22284111/php-jquery-ajax-call-throws-neterr-empty-response – Barmar

+0

은 그 내용을 읽었지만 실제로는 아무 문제가 없습니다. div를 표시/숨기기위한 기본 자바 스크립트 함수에서도 발생합니다. – GregHBushnell

답변

0

의미 어떤 메신저를 볼 수 있습니다 당신은 당신의 호스팅 GoDaddy와 함께합니다. 당신은 그 문제를 끝내고 스위치를 바꾸어서 저를 위해 고쳐야합니다.

관련 문제