Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slot machine with Ajax #59

Open
skoraich opened this issue Feb 15, 2019 · 1 comment
Open

Slot machine with Ajax #59

skoraich opened this issue Feb 15, 2019 · 1 comment

Comments

@skoraich
Copy link

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

@Fraudsterlol
Copy link

Fraudsterlol commented May 29, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants