diff --git a/web/assets/js/guestbook_admin.js b/web/assets/js/guestbook_admin.js index 8134189..92ca5c3 100644 --- a/web/assets/js/guestbook_admin.js +++ b/web/assets/js/guestbook_admin.js @@ -24,6 +24,12 @@ for (const delete_entry_button of document.getElementsByName("delete-entry")) // EDIT REPLY function edit_reply(e) { + let data = new URLSearchParams(); + data.append("entry_id", e.target.form[0].value); + data.append("message", e.target.form[1].value); + fetch("/guestbook/admin/reply/?update", {method: "POST", body: data}) + .catch(e => console.log(e)) + .then(() => window.location = "/guestbook/admin"); } for (const edit_reply_button of document.getElementsByName("edit-reply")) @@ -43,6 +49,12 @@ for (const delete_reply_button of document.getElementsByName("delete-reply")) // NEW REPLY function send_reply(e) { + let data = new URLSearchParams(); + data.append("entry_id", e.target.form[0].value); + data.append("message", e.target.form[1].value); + fetch("/guestbook/admin/reply/", {method: "POST", body: data}) + .catch(e => console.log(e)) + .then(() => window.location = "/guestbook/admin"); } for (const reply_button of document.getElementsByName("reply"))