I have a memory game code, using javascript, php and css.
I would like to register somehow the event when the game is finished by php so that I can save the results in database.
In other words I would like to place php code inside <div id="player_won"> </div> and trigger that winning event properly.
css
#player_won{ display: none; }javascript
$(document).ready(function(){ $(document).bind("game_won", gameWon); } function gameWon(){ $.getJSON(document.location.href, {won: 1}, notifiedServerWin); var $game_board = $("#game_board"); var $player_won = $("#player_won"); $game_board.hide(); $player_won.show(); $game_board = $player_won = null; };