all reference forms and health apis are done

This commit is contained in:
Chris Cochrun 2024-01-08 15:20:33 -06:00
parent 65f186fadc
commit 3f8b9cb5d8
10 changed files with 630 additions and 29 deletions

View file

@ -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;

View file

@ -6,15 +6,21 @@
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/parent-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-parent-form");
xhr.send(data);
}
});
console.log(data);
console.log("Hallo!");
return false;

View file

@ -6,15 +6,21 @@
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/teacher-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-teacher-form");
xhr.send(data);
}
});
console.log(data);
console.log("Hallo!");
return false;