all reference forms and health apis are done
This commit is contained in:
parent
65f186fadc
commit
3f8b9cb5d8
10 changed files with 630 additions and 29 deletions
|
@ -6,15 +6,22 @@
|
|||
const form = document.getElementById('form');
|
||||
const data = new FormData(form);
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
// Logic directing where to send the user after form submission based on results.
|
||||
|
||||
// For use in dev
|
||||
// Can now start using this in production IF,
|
||||
// I get the server running on the server
|
||||
/* let base = "https://api.tfcconnection.org/health-form"; */
|
||||
let base = "http://localhost:4242/church-form";
|
||||
fetch(base, {
|
||||
method: "POST",
|
||||
body: data
|
||||
}).then((res) => {
|
||||
console.log(res);
|
||||
if (res.ok) {
|
||||
window.location.href = '/thankyou/';
|
||||
};
|
||||
};
|
||||
xhr.open("POST", "https://n8n.tfcconnection.org/webhook/mt-church-form");
|
||||
xhr.send(data);
|
||||
}
|
||||
});
|
||||
|
||||
console.log(data);
|
||||
console.log("Hallo!");
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue