summaryrefslogtreecommitdiff
path: root/static/submit.js
diff options
context:
space:
mode:
authorDaniel Hader <[email protected]>2026-06-02 20:16:04 -0500
committerDaniel Hader <[email protected]>2026-06-02 20:16:04 -0500
commit14a4d586b7c7abc86674724153757f15faf7262c (patch)
treecc7f1743964d7a32f5299cee239d8126b59544e1 /static/submit.js
parentfc82931fab3ee1203ebb894840f9eede0dee2a08 (diff)
submission logic progress and submission page redirects
Diffstat (limited to 'static/submit.js')
-rw-r--r--static/submit.js28
1 files changed, 22 insertions, 6 deletions
diff --git a/static/submit.js b/static/submit.js
index 81e3aa6..03dfd69 100644
--- a/static/submit.js
+++ b/static/submit.js
@@ -1,12 +1,28 @@
-function submit() {
+async function submit() {
+ const language = document.getElementById("submission-language").value;
+ const details = document.getElementById("submission-details").value;
+ const code = document.getElementById("submission-code").value;
+
const submission = {
- user_id: 1,
- problem_id: 2,
- language: "c++",
- details: "blah blah",
- code: "blah blah",
+ problem_id: 2, // TODO validate language and problem id in server
+ language: language,
+ details: details,
+ code: code,
};
+
+ const response = await fetch("/submission", {
+ method: "post",
+ headers: { "Content-Type": "application/json" },
+ credentials: "include",
+ body: JSON.stringify(submission)
+ });
+
+ console.log(response);
+
+ const result = await response.json();
+
+ console.log(result);
}
function init() {