-
Notifications
You must be signed in to change notification settings - Fork 0
/
form-test.html
26 lines (24 loc) · 1.03 KB
/
form-test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<html>
<head>
<script src="https://wzrd.in/standalone/formdata-polyfill"></script>
<script src="https://wzrd.in/standalone/promise-polyfill@latest"></script>
<script src="https://wzrd.in/standalone/whatwg-fetch@latest"></script>
</head>
<body>
<h1>form-5</h1>
<form name="submit-to-google-sheet">
<input name="email" type="email" placeholder="Email" required>
<button type="submit">Send</button>
</form>
<script type="application/javascript">
const scriptURL = 'https://script.google.com/macros/s/AKfycbyr6HydOtGeP_Db3Ofss-ZGKBWZ1dDcyN7Gjx7F0fBquf93HkY/exec'
const form = document.forms['submit-to-google-sheet']
form.addEventListener('submit', e => {
e.preventDefault()
fetch(scriptURL, { method: 'POST', body: new FormData(form)})
.then(response => { console.log('Success!', response); window.location.href="https://bennotkin.github.io/church-land.html";} )
.catch(error => { console.error('Error!', error.message); window.location.href="https://bennotkin.github.io/blog/";} )
})
</script>
</body>
</html>