简体   繁体   中英

How could I save users points on a fortune wheel?

I want to create a wheel of fortune on my website, and, when a user spins the wheel, and he earns points, his points are saved (with his IP address).

I found this fortune wheel http://jsbin.com/qefada/11/edit?html,js,output and I want to use it on my project.

The HTML code of the canvas for the fortune wheel:

<canvas id="canvas" width="300" height="300"></canvas>

How could I do that?

Thanks!

You could use an AJAX POST request to send the value in label[ai] to a specific backend URL, that will save the value.

Example in Jquery: https://api.jquery.com/jquery.post/

$.post( "/somepage.php", { name: "John", score: label[ai] } );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM