it was async
This commit is contained in:
parent
94016c7432
commit
2257fd1f74
@ -1,21 +1,20 @@
|
|||||||
function send(){
|
async function send(){
|
||||||
|
|
||||||
data={
|
data={
|
||||||
key:document.getElementById("key").value,
|
key:document.getElementById("key").value,
|
||||||
upvote: document.getElementById("upvote").checked,
|
upvote: document.getElementById("upvote").checked,
|
||||||
downvote:document.getElementById("downvote").checked,
|
downvote:document.getElementById("downvote").checked,
|
||||||
|
|
||||||
}
|
}
|
||||||
let response = await fetch('http://localhost:9000/submit', {
|
let response = await fetch('/submit', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json;charset=utf-8'
|
'Content-Type': 'application/json;charset=utf-8'
|
||||||
},
|
},
|
||||||
body: JSON.stringify(data)
|
body: JSON.stringify(data)
|
||||||
});
|
})
|
||||||
|
|
||||||
let result = await response.json();
|
let result = await response.json();
|
||||||
document.getElementById("input").innerHTML= result.message
|
document.getElementById("input").innerHTML=result.message
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user