0

I am trying to make a simple casino website for a school project but I am having some difficulties with the javascript side of the game.

I found a Wheel of Fortune project online and wanted to use this:

var slicePrizes = ["100", "50", "500", "0", "200", "100", "150", "0"];
var prize;
var prizeText;

playGame.prototype = {
 winPrize(){
      // now we can spin the wheel again
      canSpin = true;
      // writing the prize you just won
      prizeText.text = slicePrizes[prize];

 }
}

Everything works! I only don't know how to get the var slicePrizes[prize] to a php function so I can implement my php-->mysql code? The file is saved as a .js file so I cant just open I believe?

1
  • 1
    You'll need to use AJAX. Do you have to use vanilla javascript or can you use jQuery? Commented Oct 22, 2016 at 14:23

1 Answer 1

1

You'll need to use AJAX to send the data to the server: https://developer.mozilla.org/en-US/docs/AJAX

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.