write-ups-challenges-2022-2023/k8s_easter_eggs/part4/index.html
2022-11-24 22:59:22 +01:00

25 lines
942 B
HTML

<html>
<body>
<form id="form" method="post">
<h1>Test out my cool program 😎</h1>
<p>A software tester walks into a bar and orders <input type="text" id="beerCount" name="beerCount" /> beers</p>
<button type="submit">Submit</button>
</form>
<script>
function submit(event) {
event.preventDefault();
const beerCount = document.getElementById("beerCount").value;
fetch("http://localhost:3001", {
method: 'POST',
body: beerCount.toString(),
headers: {
'Content-Type': 'application/json'
}
})
alert("The backend will now validate ur answer :)")
}
//document.getElementById("form").addEventListener("submit", submit, true)
</script>
</body>
</html>