diff --git a/public/js/submit.js b/public/js/submit.js index d7efc0d4de69c15d1c65ad2b6b3ebc1d26a91a5d..620182d8b1b38eb6259a60249b2bf943728a7143 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