-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
34 lines (29 loc) · 923 Bytes
/
index.js
File metadata and controls
34 lines (29 loc) · 923 Bytes
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
27
28
29
30
31
32
33
34
document.addEventListener('DOMContentLoaded', () => {
const contactForm = document.getElementById('contact-form');
contactForm.addEventListener('submit', async (e) => {
e.preventDefault();
const contactData = new FormData(contactForm);
const name = contactData.get('name');
const email = contactData.get('email');
const message = contactData.get('message');
const date = new Date();
const readableDate = date.toLocaleString('en-us', {
timeZone: 'America/Denver',
});
const data = {
name: name,
email: email,
message: message,
sent: readableDate,
};
await fetch(
'https://sheet.best/api/sheets/7b93a3e8-49c3-4b58-a004-936482aafc82',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
}
);
window.location = 'https://zduvall.github.io/';
});
});