This commit is contained in:
@ -1,13 +1,26 @@
|
||||
|
||||
async function getData() {
|
||||
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;
|
||||
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);
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<script> </script>
|
||||
<h1>Das ist die webseite von Gian</h1>
|
||||
<p>This is a paragraph.</p>
|
||||
|
||||
@ -42,12 +41,18 @@
|
||||
</div>
|
||||
<div class="labelcontainer">
|
||||
<label>name</label>
|
||||
<input type="text">
|
||||
<input type="text" id="name">
|
||||
</div>
|
||||
<div>
|
||||
<input type="button" onclick="getData()" value="Generate">
|
||||
<input type="button" onclick="calcChanche()" value="Generate">
|
||||
</div>
|
||||
<div>
|
||||
<p id="winners"></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
<script>
|
||||
getWinners()
|
||||
</script>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user