diff options
author | Marvin Borner | 2020-10-10 11:37:35 +0200 |
---|---|---|
committer | Marvin Borner | 2020-10-10 11:37:35 +0200 |
commit | ad2d5dd284dc733a5fbd2a9f60c30fa1b7a0da73 (patch) | |
tree | 2679845c62b523611578c021ab267268737ea923 /poll/public | |
parent | 54837fbd3614f97c06675ca416859dcbe96e1190 (diff) |
Fixed HTML injection and middlename spaces
Diffstat (limited to 'poll/public')
-rw-r--r-- | poll/public/script.js | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/poll/public/script.js b/poll/public/script.js index bfb686d..a1911fa 100644 --- a/poll/public/script.js +++ b/poll/public/script.js @@ -8,26 +8,13 @@ function appendOption(response) { response.forEach((elem) => { dropdown.insertAdjacentHTML( "beforeend", - `<option value="${elem["id"]}">${elem["name"]} ${elem["middlename"] ? elem["middlename"] : " "}${ + `<option value="${elem["id"]}">${elem["name"]} ${elem["middlename"] ? elem["middlename"] + " " : ""}${ elem["surname"] }</option>`, ); }); } -function appendQuote(response) { - response.forEach((elem) => { - document - .getElementById(elem["class"]) - .insertAdjacentHTML( - "beforeend", - `<li>${elem["name"]} ${elem["middlename"] ? elem["middlename"] : " "}${elem["surname"]}: ${ - elem["quote"] - }</li>`, - ); - }); -} - fetch("/auth/api/list") .then((response) => response.json()) .then((response) => appendOption(response)); |