diff options
author | leo <leo@azuminha.com> | 2025-08-10 17:11:33 -0300 |
---|---|---|
committer | leo <leo@azuminha.com> | 2025-08-10 17:11:33 -0300 |
commit | 99d527a5d16e84fa2fe7d20b2f94e7274e4ab3bf (patch) | |
tree | 20ecd3725f0d64fe8815310a587a85b8b3686609 /web_page/main.js | |
parent | 5fc7e375af36e9fea450714731c6e07d033a041a (diff) |
pagina
Diffstat (limited to 'web_page/main.js')
-rw-r--r-- | web_page/main.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/web_page/main.js b/web_page/main.js new file mode 100644 index 0000000..5b0bf05 --- /dev/null +++ b/web_page/main.js @@ -0,0 +1,26 @@ +function click_send(){ + data = document.getElementById("inp1").value; + console.log(data); + + fetch("http://localhost:5556/add/"+data).then(response => { + if (!response.ok) { + throw new Error('Network response was not ok'); + } + return response.text(); + }).then(result => { + console.log(result); + const res = document.createElement("p"); + res.textContent = data + " => " + "localhost:5556/" + result; + document.body.appendChild(res); + }) + return 10 * 3; +} + +document.addEventListener("DOMContentLoaded", function () { + const input = document.getElementById("inp1"); + + input.addEventListener("keydown", function (event) { + if (event.key === "Enter") + click_send(); + }); +});
\ No newline at end of file |