diff --git a/index.html b/index.html index a95569b..b786038 100644 --- a/index.html +++ b/index.html @@ -42,7 +42,9 @@

Current Backend Url:

** DEV ENV** - VCard Creator - ** DEV ENV **

-
+ + +
@@ -57,15 +59,7 @@
- +
@@ -83,8 +77,8 @@
- - + +
diff --git a/script.js b/script.js index 5ce667c..3624cf1 100644 --- a/script.js +++ b/script.js @@ -12,36 +12,69 @@ function handleCheckbox() { } } -function submitForm() { +let backendUrl = "http://127.0.0.1:8090" +let locations = JSON.parse("{}"); +function submitForm() { + fetchWithTimeout(backendUrl + "/", { + timeout: 5000, + method: 'POST', + mode: 'cors', + headers: { + 'Accept': 'image/png', + 'Content-Type': 'application/json' + }, + body: JSON.stringify( + "{" + + "\"name\":\"" + document.getElementById("full_name").value + "\"," + + "\"title\":\"" + document.getElementById("title").value + "\"," + + "\"email\":\"" + document.getElementById("email").value + "\"," + + "\"location\":\"" + document.getElementById("location").value + "\"," + + "\"extension\":\"" + document.getElementById("extension").value + "\"," + + "\"hasExtension\":\"" + document.getElementById("hasExtension").value + "\"," + + "\"cellNumber\":\"" + document.getElementById("cellNumber").value + "\"," + + "\"hasCell\":\"" + document.getElementById("hasCell").value + "\"" + + "}" + ) + }).then(response => { + console.log(response); + }); } + function getLocations() { - //TODO use (backend)/data/locations and do `document.getElementById("location").innerHtml` - //TODO and add