blob: 03dfd690cd8ea6edfd3216d4b9c4876f28480dab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
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 = {
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() {
}
|