-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.js
24 lines (22 loc) · 964 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('submitBtn').addEventListener('click', function(e) {
e.preventDefault(); // Prevent the default action
// Optionally, collect and send any additional data with the request
var formData = new FormData(); // Adjust based on your needs
fetch('https://script.google.com/macros/s/AKfycbyuGbm6fFtzdbhauomcvwxkBRvg_w2IeybO4UJ8baEGnZD7lP6SDRjc5zwwSayWCKBgHA/exec', {
method: 'POST',
body: formData
})
.then(response => response.json()) // Parse the JSON response
.then(data => {
if(data.url) {
window.location.href = data.url; // Redirect to the URL from the response
} else {
console.error('URL not found in response');
}
})
.catch(error => {
console.error('Error:', error);
});
});
});