summaryrefslogtreecommitdiff
path: root/static/submit.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/submit.js')
-rw-r--r--static/submit.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/static/submit.js b/static/submit.js
index 03dfd69..9708e0c 100644
--- a/static/submit.js
+++ b/static/submit.js
@@ -25,6 +25,20 @@ async function submit() {
console.log(result);
}
-function init() {
+async function init() {
+ const url_params = new URLSearchParams(window.location.search);
+ const problem_id = url_params.get("problem_id");
+ const response = await fetch(`/problem/${problem_id}`);
+ const problem = await response.json();
+
+ const problem_div = document.getElementById("submission-problem");
+
+ const title = document.createElement("h2");
+ title.innerHTML = `Problem: ${problem.title}`;
+ problem_div.appendChild(title);
+
+ const description = document.createElement("p");
+ description.innerHTML = problem.description;
+ problem_div.appendChild(description);
}