Answer the question
In order to leave comments, you need to log in
How can I make the calculations performed on the server when the button is clicked and the result is sent to JS?
Hello. I am a beginner frontender. I need help with the following: I want to create a valid coinflip. The probability of winning, just like the calculation mechanism, will serve as random. Those. onclick triggers a JS function to calculate randomness in the range of two numbers (1-2). And if 1 then loss, else gain. And the thing is that I do not want the calculation method and the range of numbers (the probability of winning) to be visible to the user. To do this, I want to do calculations on the server, and here is the problem. How? I want to write in java. I have already begun to study and I can write such a program by calculation. How can I make it so that when the user clicks on the button, he sends a request to the server, calculations are made on the server, and the boolean result goes to JS, and JS outputs an alert based on the server's calculation? Please chew, digest and give chewed, digested food.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question