35 lines
897 B
HTML
35 lines
897 B
HTML
<!doctype html>
|
|
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
|
|
<title>Secret Santa</title>
|
|
|
|
<h1>Secret Santa</h1>
|
|
|
|
<select id="person">
|
|
<option selected disabled>Who is drawing?</option>
|
|
__OPTIONS__
|
|
</select>
|
|
|
|
<div id="result"></div>
|
|
|
|
<script>
|
|
document.getElementById("person").addEventListener('change', event => {
|
|
const options = {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({ "person": event.target.value })
|
|
};
|
|
|
|
console.log(options);
|
|
|
|
fetch("api", options)
|
|
.then(response => response.text())
|
|
.then(text => {
|
|
document.getElementById("result").textContent = `Your draw: ${text}`;
|
|
});
|
|
});
|
|
</script>
|