From 9291dd7c1990c65b16f902a7fac496b121e3a1cc Mon Sep 17 00:00:00 2001 From: Gnieark Date: Tue, 7 Jun 2016 10:38:08 +0200 Subject: [PATCH] async=false --- html/testBotScripts/connectfour.html | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/html/testBotScripts/connectfour.html b/html/testBotScripts/connectfour.html index 07843c5..dbf9c13 100644 --- a/html/testBotScripts/connectfour.html +++ b/html/testBotScripts/connectfour.html @@ -210,20 +210,17 @@ function startGame(){ for (var p = 1; p < 3 ; p++){ if(document.getElementById("player" + p + "Type").value == "bot"){ - 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.setRequestHeader("Content-Type", "application/json"); 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);