Working around firefox cors issues

This commit is contained in:
Archie Baer 2019-06-15 22:28:43 +01:00
parent 904b82f32b
commit 090ca3c2d6
1 changed files with 5 additions and 3 deletions

View File

@ -4,7 +4,7 @@ function signup() {
if (sent) return; if (sent) return;
var email = emailAddr.value; var email = emailAddr.value;
if (!validateEmail(email)) return; if (!validateEmail(email)) return;
mailbtn.classList.add("fa-clock"); mailbtn.classList.add("fa-times");
mailbtn.classList.remove("mail-button"); mailbtn.classList.remove("mail-button");
mailbtn.blur(); mailbtn.blur();
console.log("Sending request..."); console.log("Sending request...");
@ -12,8 +12,10 @@ function signup() {
var req = new XMLHttpRequest(); var req = new XMLHttpRequest();
req.onload = function () { req.onload = function () {
console.log(this.status + ": " + this.responseText); console.log(this.status + ": " + this.responseText);
mailbtn.classList.remove("fa-clock"); if (this.status) {
mailbtn.classList.add("fa-" + (this.status === 200 ? "check" : "times")); mailbtn.classList.remove("fa-times");
mailbtn.classList.add("fa-check");
}
}; };
req.open("POST", "https://whserver.dforms.point0.tech/589550963468140574"); req.open("POST", "https://whserver.dforms.point0.tech/589550963468140574");
req.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");