contact form for BroccoliWallet.com

This commit is contained in:
AJ ONeal 2018-05-04 23:23:16 -06:00
parent 50cbb8bbba
commit bf6d934cd0

View File

@ -11,7 +11,7 @@
Name is optional and could be anything (it's just a text field for comments) Name is optional and could be anything (it's just a text field for comments)
--> -->
<div class="js-contact-thanks"> <div class="js-contact-thanks" hidden>
Thanks! We'll be in touch soon! Thanks! We'll be in touch soon!
</div> </div>
<form class="js-contact-form" action="#"> <form class="js-contact-form" action="#">
@ -21,7 +21,7 @@
<br> <br>
<label>Email:</label> <label>Email:</label>
<input class="js-contact-name" type="email" required> <input class="js-contact-email" type="email" required>
<br> <br>
@ -36,25 +36,25 @@ function saveContact(name, email) {
email = email.toLowerCase().trim(); email = email.toLowerCase().trim();
name = (name || '').trim(); name = (name || '').trim();
return window.fetch('https://api.ppl.family/api/ppl.family/public/list', { return window.fetch('https://api.ppl.family/api/ppl.family/public/list', {
method: 'POST' method: 'POST'
, cors: true , cors: true
, headers: new Headers({ 'Content-Type': 'application/json' }) , headers: new Headers({ 'Content-Type': 'application/json' })
, body: JSON.stringify({ address: email, comment: 'Broccoli: ' + name }) , body: JSON.stringify({ address: email, comment: 'Broccoli: ' + name })
}).then(function (resp) { }).then(function (resp) {
return resp.json().then(function (data) { return resp.json().then(function (data) {
/* /*
if (data.error) { if (data.error) {
window.alert("Couldn't save your contact. Email coolaj86@gmail.com instead."); window.alert("Couldn't save your contact. Email coolaj86@gmail.com instead.");
return; return;
} }
*/ */
}); });
}, function () { }, function () {
/* /*
window.alert("Didn't get your contact. Bad network connection? Email coolaj86@gmail.com instead."); window.alert("Didn't get your contact. Bad network connection? Email coolaj86@gmail.com instead.");
*/ */
}); });
} }
window.document window.document