27 lines
806 B
JavaScript
27 lines
806 B
JavaScript
|
|
async function calcChanche() {
|
|
const name = document.getElementById("name").value
|
|
const chance = document.getElementById("Chance").value
|
|
const mult = document.getElementById("Multiplicator").value
|
|
const url = "/random?chance="+chance+"&multiplicator="+mult+"&name="+name;
|
|
try {
|
|
const response = await fetch(url);
|
|
const content = await response.text()
|
|
|
|
document.getElementById("won").innerText=content
|
|
getWinners()
|
|
} catch (error) {
|
|
console.error(error.message);
|
|
}
|
|
}
|
|
async function getWinners() {
|
|
const url = "/winners"
|
|
try {
|
|
const response = await fetch(url);
|
|
const content = await response.text()
|
|
|
|
document.getElementById("winners").innerText=content
|
|
} catch (error) {
|
|
console.error(error.message);
|
|
}
|
|
} |