JS
This commit is contained in:
parent
cab886e5ab
commit
61a69f7351
28
script.js
28
script.js
@ -16,6 +16,21 @@ let backendUrl = "http://127.0.0.1:8090"
|
|||||||
let locations = JSON.parse("{}");
|
let locations = JSON.parse("{}");
|
||||||
|
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
|
let 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 + "\"" +
|
||||||
|
"}"
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(body);
|
||||||
|
|
||||||
fetchWithTimeout(backendUrl + "/", {
|
fetchWithTimeout(backendUrl + "/", {
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -24,18 +39,7 @@ function submitForm() {
|
|||||||
'Accept': 'image/png',
|
'Accept': 'image/png',
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: JSON.stringify(
|
body: body
|
||||||
"{" +
|
|
||||||
"\"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 => {
|
}).then(response => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user