From 380344ed92536327555b4e24e05f70ea8b2f8dd2 Mon Sep 17 00:00:00 2001 From: MHEN2606 <matthew.mahendra@gmail.com> Date: Fri, 10 Nov 2023 21:32:10 +0700 Subject: [PATCH] feat: Rendering on Submission File --- public/js/submit.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/public/js/submit.js b/public/js/submit.js index d7efc0d..620182d 100644 --- a/public/js/submit.js +++ b/public/js/submit.js @@ -19,4 +19,28 @@ const render = () => { const title = document.getElementById("assignment_name"); const description = document.getElementById("description"); +const submitForm = () => { + const xhr = new XMLHttpRequest(); + xhr.open("POST", `http://localhost:5000/api/files/scholarship/${sid}/assignment/${aid}`) + + xhr.onload = () => { + const res = JSON.parse(xhr.response); + console.log(res.data); + + if (res.status === 'success') { + + title.innerHTML = res.data.assignment_name + description.innerHTML = res.data.assignment_description + + } + } + + const body = { + "uid": uid, + "file_path": file_path + } + + xhr.send(body) +} + document.addEventListener("DOMContentLoaded", render); \ No newline at end of file -- GitLab