18 lines
497 B
JavaScript
18 lines
497 B
JavaScript
|
const form = document.getElementById("schematic-form");
|
||
|
form.onsubmit = async (e) => {
|
||
|
e.preventDefault();
|
||
|
console.log(e);
|
||
|
const data = new FormData(form);
|
||
|
console.log(data);
|
||
|
try {
|
||
|
const response = await fetch("/extracts", {
|
||
|
method: "POST",
|
||
|
body: data
|
||
|
});
|
||
|
const result = await response.json();
|
||
|
console.log("Success:", result);
|
||
|
form.reset();
|
||
|
} catch (error) {
|
||
|
console.error("Error: " + error);
|
||
|
}
|
||
|
};
|