front-end of mt-form nearly ready for publishing

Front end of mt-form is basically ready. There could be some tweaks to
wording here and there, but it's mostly done. Will need to adjust how
it sends the form when we actually send it on, but for now, it's ready.
This commit is contained in:
Chris Cochrun 2024-01-04 15:05:41 -06:00
parent 9b8ec651d8
commit d0ebf6baab
2 changed files with 30 additions and 16 deletions

View file

@ -12,22 +12,36 @@
const age = calculate_age(birthdate);
data.append("age", age);
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.
// This is how to send them. window.location.href = '/thankyou/';
let base = "http://localhost:4242/mt-form";
var payment = document.getElementById('registration').value;
window.location.href = '/mt-health-form?mtregistration=' + payment;
// Need to eventually get the user here: https://secure.myvanco.com/L-Z772/campaign/C-13DM3
fetch(base, {
method: "POST",
body: data
}).then((res) => {
console.log(res);
if (res.ok) {
//var payment = document.getElementById('registration').value;
//window.location.href = '/mt-health-form?mtregistration=' + payment;
console.log(res);
}
};
});
/* 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.
* // This is how to send them. window.location.href = '/thankyou/';
* var payment = document.getElementById('registration').value;
* window.location.href = '/mt-health-form?mtregistration=' + payment;
* // Need to eventually get the user here: https://secure.myvanco.com/L-Z772/campaign/C-13DM3
* }
* }; */
/* xhr.open("POST", "https://n8n.tfcconnection.org/webhook/mt-application"); */
xhr.open("POST", "https://n8n.tfcconnection.org/webhook/mt-application");
xhr.send(data);
console.log(data);
console.log("Hallo!");
/* xhr.open("POST", "https://n8n.tfcconnection.org/webhook/mt-application");
* xhr.send(data);
* console.log(data);
* console.log("Hallo!"); */
/* return false; */
}