-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact.html
More file actions
54 lines (40 loc) · 2.17 KB
/
contact.html
File metadata and controls
54 lines (40 loc) · 2.17 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<h3>Contact JETT</h3>
<p>Keep watching this space for latest updates, upcoming projects & announcements</p>
<form id="contactJETT" action="https://script.google.com/macros/s/AKfycby28O0Yt2eGCGLMbT-Mrzmq7gz0I-CwBo98NMfra76s8goExDyPUPVrq3SHh8z8QhhS/exec" method="POST">
<div class="inputboxouter">
<input type="email" name="email" class="search" required placeholder="Email Address *" />
<input type="text" name="firstName" class="search" placeholder="First Name" />
<input type="text" name="lastName" class="search" placeholder="Last Name" />
<input type="tel" name="mobile" class="search" placeholder="Mobile Number" />
<input type="text" name="countryISO" class="search" placeholder="Country ISO (e.g., US)" />
<input type="text" name="companyName" class="search" placeholder="Company Name" />
<input type="text" name="companyType" class="search" placeholder="Company Type" />
<textarea name="message" class="search" placeholder="Your Message"></textarea>
<input type="hidden" name="type" class="search" value="email subscription" />
<button type="submit" name="submit" area-lable-name="submit" class="btnsubmit">Subscribe</button>
</div>
</form>
<div id="post-message" style="display: none;"></div>
<script>
// Get the form and message elements
const form = document.getElementById('contactJETT');
const message = document.getElementById('post-message');
// Submit form using AJAX
form.addEventListener('submit', function(event) {
event.preventDefault(); // Prevent default form submission
const xhr = new XMLHttpRequest();
xhr.open('POST', form.action, true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
message.textContent = 'Thankyou for contacting JETT';
message.style.display = 'block';
form.reset();
} else {
message.textContent = 'Something went wrong while submitting the form. Please retry.';
message.style.display = 'block';
}
};
xhr.send(new URLSearchParams(new FormData(form)).toString());
});
</script>