Example #1
0
</div>
<div class="row">
    <div class="col-xs-12">
        <div class="form-group"><button id="btn-next-player" class="btn btn-primary btn-lg center-block">Nächster Spieler</button></div>
    </div>
</div>
<div class="row">
    <div class="col-xs-12">
        <div class="well well-sm">Aktueller Spieler: <span id="current-player" class="label label-default"></span></div>
    </div>
</div>

<?php 
$gameArray = Games::selectById($_POST['gameid']);
$currentPlayerId = $gameArray['current_player'];
$players = Players::selectArrayByGameId($_POST['gameid']);
?>

<script type="text/JavaScript">
    var mouseClickCount = 0,
        pageUrl = document.getElementById("page-url").innerHTML,
        currentPlayerId = <?php 
echo json_encode($currentPlayerId);
?>
;

    // Set current player visible on display
    $("#current-player").html(currentPlayerId);

    // Add listener
    $("#btn-next-player").on("click", onNextPlayerClicked);