generated from dwd/boilarplate-astro-tailwind
s1
This commit is contained in:
@@ -64,7 +64,6 @@ import Layout from "../layouts/Layout.astro";
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline>
|
||||
|
||||
document.getElementById('formSection').addEventListener('submit', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -75,12 +74,12 @@ import Layout from "../layouts/Layout.astro";
|
||||
email: document.getElementById('email').value,
|
||||
message: document.getElementById('message').value
|
||||
},
|
||||
owner: 'owner_value',
|
||||
domain: 'domain_value',
|
||||
owner: 'Holy Wisdom Public School',
|
||||
domain: window.location.origin,
|
||||
referrer: document.referrer
|
||||
};
|
||||
|
||||
fetch('http://192.168.0.166:2053/v3/contact-form-processor/', {
|
||||
fetch('https://api.siliconpin.com/v3/contact-form-processor/', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
@@ -90,96 +89,25 @@ import Layout from "../layouts/Layout.astro";
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
console.log('Data submitted successfully');
|
||||
// console.log('Data submitted successfully');
|
||||
if(data.success === true){
|
||||
document.getElementById('formSection').style.display = 'none';
|
||||
document.getElementById('thankYouSection').style.display = 'block';
|
||||
}
|
||||
console.log(data.success)
|
||||
} else {
|
||||
console.log('Error: ' + data.message);
|
||||
// console.log('Error: ' + data.message);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
console.log('An error occurred while submitting the form');
|
||||
// console.error('Error:', error);
|
||||
// console.log('An error occurred while submitting the form');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
// document.addEventListener('DOMContentLoaded', function () {
|
||||
// const contactForm = document.getElementById('contactForm');
|
||||
// const formSection = document.getElementById('formSection');
|
||||
// const thankYouSection = document.getElementById('thankYouSection');
|
||||
// const nameInput = document.getElementById('name');
|
||||
// const emailInput = document.getElementById('email');
|
||||
// const phoneInput = document.getElementById('phone');
|
||||
// const messageInput = document.getElementById('message');
|
||||
|
||||
// contactForm.addEventListener('submit', async function (event) {
|
||||
// event.preventDefault();
|
||||
// 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(data)
|
||||
// });
|
||||
// if (response.ok) {
|
||||
// console.log('Form data submitted successfully');
|
||||
// formSection.style.display = 'none';
|
||||
// thankYouSection.style.display = 'block';
|
||||
// } else {
|
||||
// console.error('Failed to submit form data');
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error('An error occurred:', error);
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
</script>
|
||||
<style>
|
||||
.gradintBack {
|
||||
background: linear-gradient(0deg, rgb(71, 174, 106) 0%, rgba(255, 255, 255) 40%);
|
||||
}
|
||||
</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);
|
||||
})
|
||||
} -->
|
||||
@@ -154,7 +154,7 @@ let inSportsData = [
|
||||
<main>
|
||||
<div>
|
||||
<section class="container-fluid gradintBack">
|
||||
<div class="container mx-auto px-4 flex flex-col-reverse lg:flex-row place-items-center">
|
||||
<div class="container mx-auto px-4 flex flex-col-reverse xl:flex-row place-items-center gap-y-4">
|
||||
<div class="w-full">
|
||||
<img class="lg:max-w-3xl" src="/img/school2.png" alt="" />
|
||||
</div>
|
||||
@@ -318,10 +318,10 @@ let inSportsData = [
|
||||
<div>
|
||||
<dialog id="formModal" class="max-w-2xl rounded-xl">
|
||||
<form method="dialog" class="">
|
||||
<button class="text-3xl text-red-500 bg-[#3084b550] hover:bg-[#3084b580] px-4 py-2 rounded-full float-right">✘</button>
|
||||
<button type="submit" class="text-3xl text-red-500 bg-[#3084b550] hover:bg-[#3084b580] px-4 py-2 rounded-full float-right">✘</button>
|
||||
<div class="">
|
||||
<ContactForm client:visible/>
|
||||
</div>
|
||||
<ContactForm client:visible />
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
</div>
|
||||
|
||||
@@ -11,11 +11,10 @@ import FAQ from "../components/FAQ.vue";
|
||||
<div class="pb-16">
|
||||
<section class="container-fluid gradintBack">
|
||||
<div
|
||||
class="container mx-auto px-4 flex flex-col-reverse lg:flex-row place-items-center"
|
||||
class="container mx-auto px-4 flex flex-col-reverse xl:flex-row place-items-center gap-y-4"
|
||||
>
|
||||
<div class="w-full">
|
||||
<!-- <img class="lg:max-w-2xl" src="/img/image.png" alt=""> -->
|
||||
<img class="lg:max-w-2xl" src="public/img/school-image-4.png" alt=""
|
||||
<img class="w-full xl:max-w-2xl" src="public/img/school-image-4.png" alt=""
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col w-full">
|
||||
|
||||
Reference in New Issue
Block a user