async=false
This commit is contained in:
parent
332597a9d1
commit
9291dd7c19
|
@ -210,20 +210,17 @@ function startGame(){
|
||||||
for (var p = 1; p < 3 ; p++){
|
for (var p = 1; p < 3 ; p++){
|
||||||
|
|
||||||
if(document.getElementById("player" + p + "Type").value == "bot"){
|
if(document.getElementById("player" + p + "Type").value == "bot"){
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.onreadystatechange = function(){if(xhr.readyState == 4){
|
|
||||||
if(xhr.status == 200) {
|
|
||||||
addLog('Message d\'init envoyé au bot player ' + p );
|
|
||||||
}else{
|
|
||||||
addLog('player ' + p + ' n est pas joignable ' + xhr.status);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}};
|
|
||||||
xhr.open("POST", document.getElementById('url' + p).value, false);
|
xhr.open("POST", document.getElementById('url' + p).value, false);
|
||||||
xhr.setRequestHeader("Content-Type", "application/json");
|
xhr.setRequestHeader("Content-Type", "application/json");
|
||||||
xhr.send(' {"game-id":"1127","action":"init","game":"connectFour","players":2,"board":"","player-index":' + (p - 1) +'}');
|
xhr.send(' {"game-id":"1127","action":"init","game":"connectFour","players":2,"board":"","player-index":' + (p - 1) +'}');
|
||||||
}
|
}
|
||||||
|
if(xhr.status == 200) {
|
||||||
|
addLog('Message d\'init envoyé au bot player ' + p );
|
||||||
|
}else{
|
||||||
|
addLog('player ' + p + ' n est pas joignable ' + xhr.status);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
play(1);
|
play(1);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user