-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
30 lines (25 loc) · 1.05 KB
/
script.js
File metadata and controls
30 lines (25 loc) · 1.05 KB
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
document.getElementById('sql-form').addEventListener('submit', async (e) => {
e.preventDefault();
const username = document.getElementById('sql-username').value;
const password = document.getElementById('sql-password').value;
const res = await fetch('/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password })
});
const data = await res.json();
document.getElementById('sql-output').innerText = data.result;
});
document.getElementById('xss-form').addEventListener('submit', async (e) => {
e.preventDefault();
const comment = document.getElementById('xss-input').value;
const res = await fetch('/comment', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ comment })
});
const data = await res.text();
const commentBox = document.getElementById('xss-comments');
commentBox.innerHTML += `<div>${data}</div>`;
document.getElementById('xss-input').value = '';
});