js gestion erreur ajax

This commit is contained in:
Gnieark 2016-05-11 11:07:39 +02:00
parent 8433823cd4
commit 2aff5db168

View File

@ -18,6 +18,9 @@ function connectFour(bot1,bot2,xd_check){
xhr.onreadystatechange = function(){if(xhr.readyState == 4){ xhr.onreadystatechange = function(){if(xhr.readyState == 4){
if(xhr.status == 200) { if(xhr.status == 200) {
document.getElementById('fightResult').innerHTML = xhr.responseText; document.getElementById('fightResult').innerHTML = xhr.responseText;
}else{
alert ('error ' + xhr.status);
break;
} }
}}; }};
xhr.open("POST", '/connectFour', true); xhr.open("POST", '/connectFour', true);