jQuery-SlotMachine icon indicating copy to clipboard operation
jQuery-SlotMachine copied to clipboard

Slot machine with Ajax

Open skoraich opened this issue 6 years ago • 1 comments

Hello i wana use tricky slot machine with ajax , to choose the numbers to display the result from a database, any ideas?

skoraich avatar Feb 15 '19 16:02 skoraich

Sorry for the late reply.

Anyways, I implemented this feature yesterday. (Laravel). It is not really hard.

Here is how you can do it (VERY BASIC):

  1. Create a random number generator function in PHP (With probability stuff etc) and return the generated number. You can also return a specific value from your database.

  2. Send an AJAX request to the PHP file / route that includes the generator function and store the response text in a variable. (On button click for example).

  3. On AJAX success run the slot machine. Make sure to add the following content to your slot machine before doing so:

randomize() { return YOURVAR; }

  1. You are done. Please also be aware of the fact that the images of your slot machine div start at number 0. Number 0 would be picture 1 and so on.

Good Luck.

Fraudsterlol avatar May 29 '20 15:05 Fraudsterlol