-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinline_script_0.js
More file actions
49 lines (22 loc) · 895 Bytes
/
inline_script_0.js
File metadata and controls
49 lines (22 loc) · 895 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
const form = document.getElementById('emailForm');
form.addEventListener('submit', async (e) => {
e.preventDefault();
const formData = new FormData(form);
const url = 'https://script.google.com/macros/s/AKfycbzd19Lr4aju-TLwqwLiCel6o0aLpUnOsbm2CqQTktBtavYktq6lF0l27iD7Hnqd912JOw/exec'; // Updated URL with CORS Anywhere
try {
const response = await fetch(url, {
method: 'POST',
body: formData
});
if (response.ok) {
alert('Email submitted successfully!');
form.reset();
} else {
console.error('Server Error:', response.statusText);
alert('Failed to submit email.');
}
} catch (error) {
console.error('Client Error:', error);
alert('An error occurred while submitting the form.');
}
});