From 2257fd1f74577ab7e797a314b962078939582b38 Mon Sep 17 00:00:00 2001 From: nannal Date: Wed, 9 Dec 2020 22:30:22 +0200 Subject: [PATCH] it was async --- Public/script.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Public/script.js b/Public/script.js index eb524d9..f45dcd7 100644 --- a/Public/script.js +++ b/Public/script.js @@ -1,21 +1,20 @@ -function send(){ - +async function send(){ data={ key:document.getElementById("key").value, upvote: document.getElementById("upvote").checked, downvote:document.getElementById("downvote").checked, } - let response = await fetch('http://localhost:9000/submit', { + let response = await fetch('/submit', { method: 'POST', headers: { 'Content-Type': 'application/json;charset=utf-8' }, body: JSON.stringify(data) - }); + }) let result = await response.json(); - document.getElementById("input").innerHTML= result.message + document.getElementById("input").innerHTML=result.message }