generated from dwd/boilarplate-astro-tailwind
s1
This commit is contained in:
@@ -54,7 +54,7 @@ import Layout from "../layouts/Layout.astro";
|
||||
<input type="submit" value="Submit" class="bg-[#3084b5] text-white rounded-lg py-2.5 px-6 float-right"/>
|
||||
</div>
|
||||
</form>
|
||||
<div class="flex " id="thankYouSection" style="display: none;">
|
||||
<div class="flex" id="thankYouSection" style="display: none;">
|
||||
<h1 class="text-center text-black text-4xl">Thank You</h1>
|
||||
</div>
|
||||
</div>
|
||||
@@ -75,22 +75,26 @@ import Layout from "../layouts/Layout.astro";
|
||||
|
||||
contactForm.addEventListener('submit', async function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
const formData = {
|
||||
name: nameInput.value,
|
||||
email: emailInput.value,
|
||||
mobile: phoneInput.value,
|
||||
message: messageInput.value
|
||||
};
|
||||
console.log("Form Data", formData)
|
||||
const url = 'https://api8.siliconpin.com/items/hps_contact';
|
||||
let data = {
|
||||
data:{
|
||||
name: nameInput.value,
|
||||
phone: phoneInput.value,
|
||||
email: emailInput.value,
|
||||
message: messageInput.value
|
||||
},
|
||||
owner: "Holly Wisdom Public School",
|
||||
domain: window.location.origin,
|
||||
referrer: "Holly Wisdom Public School"
|
||||
}
|
||||
console.log("Form Data", data)
|
||||
const url = 'https://api.siliconpin.com/v3/contact-form-processor/';
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(formData)
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
if (response.ok) {
|
||||
console.log('Form data submitted successfully');
|
||||
@@ -109,4 +113,34 @@ import Layout from "../layouts/Layout.astro";
|
||||
.gradintBack {
|
||||
background: linear-gradient(0deg, rgb(71, 174, 106) 0%, rgba(255, 255, 255) 40%);
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
<!-- function submitForm(){
|
||||
const formData = {
|
||||
data: {
|
||||
name: document.getElementById('name').value,
|
||||
email: document.getElementById('email').value,
|
||||
phone: document.getElementById('phone').value
|
||||
},
|
||||
owner: document.getElementById('owner').value,
|
||||
domain: document.getElementById('domain').value,
|
||||
referrer: document.getElementById('referrer').value
|
||||
};
|
||||
fetch(`http://192.168.0.166:2053/v3/contact-form/`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type' : 'application/json',
|
||||
},
|
||||
body: JSON.stringify(formData)
|
||||
})
|
||||
.then(response => {
|
||||
if(response.ok){
|
||||
console.log('Form submitted succesfully!');
|
||||
}else{
|
||||
console.log('Form submitted faild!');
|
||||
}
|
||||
})
|
||||
.then(error => {
|
||||
console.error('an error occoured', error);
|
||||
})
|
||||
} -->
|
||||
Reference in New Issue
Block a user