diff --git a/src/arenas/connectFour/act.php b/src/arenas/connectFour/act.php index 998a7d4..8a4d442 100644 --- a/src/arenas/connectFour/act.php +++ b/src/arenas/connectFour/act.php @@ -3,12 +3,23 @@ require_once(__DIR__."/functions.php"); switch ($_POST['act']){ + case "newfight": + //initialiser la map + $_SESSION['map']=array( + array("","","","","","",""), + array("","","","","","",""), + array("","","","","","",""), + array("","","","","","",""), + array("","","","","","",""), + array("","","","","","",""), + ); + + + echo json_encode($_SESSION['map']); case "fight": - - - break; - + die; + break; default: break; } \ No newline at end of file diff --git a/src/arenas/connectFour/functions.php b/src/arenas/connectFour/functions.php index 09b1f14..1f60e7e 100644 --- a/src/arenas/connectFour/functions.php +++ b/src/arenas/connectFour/functions.php @@ -1,4 +1,5 @@ Please wait...

'; + var xhr = Ajx(); + xhr.onreadystatechange = function(){if(xhr.readyState == 4){ + if(xhr.status == 200) { + document.getElementById('fightResult').innerHTML = xhr.responseText; + } + }}; + xhr.open("POST", '/connectFour', true); + xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + xhr.send('act=newFight&bot1=' + bot1 + '&bot2=' + bot2 + '&xd_check=' + xd_check); +}