layout | title |
---|---|
default |
Mailing List - |
Beta
×
<script>
var flag = false;
function saveToFirebase(email) {
let mails = firebase.database();
if(flag){
alert('you have already entered a valid email address');
error();
return;
}
email = email.trim()
if (!email.includes('@') || !email.includes('.') || email.includes(' ')){
error();
return;
}
var emailObject = {
email: email
};
mails.ref('subscription-entries').push().set(emailObject)
.then(function(snapshot) {
success(); // some success method
}, function(error) {
console.log('error' + error);
error(); // some error method
});
}
function error(){
document.getElementById('inputEmail').classList.remove("is-valid");
document.getElementById('inputEmail').classList.add("is-invalid");
return;
}
function success(){
document.getElementById('inputEmail').classList.remove("is-invalid");
document.getElementById('inputEmail').classList.add("is-valid");
flag = true;
return;
}
</script>
Hey There! Welcome to our new mailing list page! We've recently made big changes to server side stuff, apologies for any errors