Question: Need help to create a dice game using AJAX, PHP, HTML and JAVASCRIPT. Also use images dice1.png, dice2.png, dice3.png, dice4.png,dice5.png,dice6.png. Instruction here: (1) Create a
Need help to create a dice game using AJAX, PHP, HTML and JAVASCRIPT. Also use images dice1.png, dice2.png, dice3.png, dice4.png,dice5.png,dice6.png.
Instruction here:





(1) Create a web page for the user to plav dices against a server. as the screenshot below. (2) The title of the webpage is Dice; (3) Put your name on the page in Heading 1 text; (4) Place a button with caption "Play"; (5) Put two images below the button, both showing one-dot face initially. The image on the left is for user's dice, the other is for the server; (6) When the user clicks "Play" button, the webpage starts to calculate two random integers in the range of 1 and 6 inclusively to update dice images every 500 milliseconds; (7) At the same time, the webpage uses AJAX/AJAJ to get a random number from a PHP page; (8) The PHP page first sleeps for 5 seconds, and then calculates a random integer in the range of 1 and 6 inclusively and returns it; (9) On receipt of the message from the PHP page, the webpage stops the periodic timer started in step (6), and uses the random integer it received to update the image on the right; (10) The webpage compares the two dice numbers (one calculated locally for the user, the other is the one returned from PHP page) and shows who wins the game or if there is a tie, as the screenshot below
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
