diff options
author | Marvin Borner | 2021-01-29 14:53:08 +0100 |
---|---|---|
committer | Marvin Borner | 2021-01-29 14:53:08 +0100 |
commit | ce7c01ed413c5aaec36bbab0da601118855d1c16 (patch) | |
tree | c997d51655293fc8584ae34eb0bdeced0867b6fe /prediction/public/script.js | |
parent | b5acbb8cb31fa489b6f8569d9ee3c309800e8069 (diff) |
Okidoki
Diffstat (limited to 'prediction/public/script.js')
-rw-r--r-- | prediction/public/script.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/prediction/public/script.js b/prediction/public/script.js index 364789f..029c4f8 100644 --- a/prediction/public/script.js +++ b/prediction/public/script.js @@ -11,7 +11,9 @@ function appendOption(response) { response.forEach((elem, i) => { dropdown.insertAdjacentHTML( "beforeend", - `<option value="${elem["id"]}">${elem["name"]} ${elem["middlename"] ? elem["middlename"] + " " : ""}${elem["surname"]}</option>`, + `<option value="${elem["id"]}">${elem["name"]} ${elem["middlename"] ? elem["middlename"] + " " : ""}${ + elem["surname"] + }</option>`, ); }); } @@ -35,5 +37,10 @@ submit.addEventListener("click", async (e) => { const body = JSON.stringify({ teacher }); const resp = await fetch("api/set", { method, body, headers: { "Content-Type": "application/json" } }); const res = await resp.json(); - if (res.success) method = "PUT"; -});
\ No newline at end of file + if (res.success) { + method = "PUT"; + alert("Okidoki!"); + } else { + alert("Sorry, Fehler!"); + } +}); |