backend connection
This commit is contained in:
313
contact.php
313
contact.php
@@ -89,21 +89,36 @@ include("_navbar.php");
|
|||||||
<form class="" role="form" method="post">
|
<form class="" role="form" method="post">
|
||||||
<div class="form-group mb-5">
|
<div class="form-group mb-5">
|
||||||
<!-- Input -->
|
<!-- Input -->
|
||||||
<input class="form-control" type="text" aria-required="true" name="widget-contact-form-name" id="name1" placeholder="Full name" required>
|
<input type="text" aria-required="true" name="widget-contact-form-name" required
|
||||||
|
class="form-control required name" id="name1" placeholder="Enter your Name">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group mb-5">
|
<div class="form-group mb-5">
|
||||||
<!-- Input -->
|
<!-- Input -->
|
||||||
|
<input class="form-control" id="phn" type="number" name="telephone"
|
||||||
<input class="form-control" type="tel" id="phn" name="telephone" placeholder="Phone Number" required>
|
placeholder="Enter your Contact number" required>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group mb-5">
|
<div class="form-group mb-5">
|
||||||
<!-- Input -->
|
<!-- Input -->
|
||||||
<input class="form-control" type="email" id="email" aria-required="true" name="widget-contact-form-email" placeholder="hello@domain.com" required>
|
<input type="email" id="email" aria-required="true" name="widget-contact-form-email"
|
||||||
|
required class="form-control required email" placeholder="Enter your Email">
|
||||||
|
<p id="emailError" style="color: red; display: none;">Enter a valid email address</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
<div class="form-group mb-5">
|
<input type="text" class="form-control" id="addr" name="address"
|
||||||
|
placeholder="Enter your Full Address" required>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<select id="req" class="form-control" name="gender" required>
|
||||||
|
<option value="">In which field you are interested in?</option>
|
||||||
|
<option>Training</option>
|
||||||
|
<option>Partnership</option>
|
||||||
|
<option>Preschool setup for High School</option>
|
||||||
|
<option>Others</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--<div class="form-group mb-5">
|
||||||
<select class="form-control" name="cars" id="req" name="gender" required>
|
<select class="form-control" name="cars" id="req" name="gender" required>
|
||||||
<option value="">In which field you are interested in?</option>
|
<option value="">In which field you are interested in?</option>
|
||||||
<option value="Montessori Teacher Training">Training</option>
|
<option value="Montessori Teacher Training">Training</option>
|
||||||
@@ -111,38 +126,39 @@ include("_navbar.php");
|
|||||||
<option value="Montessori Teacher Training">Joint Montessori Network</option>
|
<option value="Montessori Teacher Training">Joint Montessori Network</option>
|
||||||
<option value="Pre and Primary Teacher Training">Other</option>
|
<option value="Pre and Primary Teacher Training">Other</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>-->
|
||||||
|
<!---
|
||||||
<div class="form-group mb-5">
|
<div class="form-group mb-5">
|
||||||
<select class="form-control" name="cars" id="cars" required>
|
<select class="form-control" name="cars" id="cars">
|
||||||
<option value="">Which country are you based in?</option>
|
<option value="">Which country are you based in?</option>
|
||||||
<option value="Montessori Teacher Training">Training</option>
|
<option value="Montessori Teacher Training">Training</option>
|
||||||
<option value="Pre and Primary Teacher Training">Partnership</option>
|
<option value="Pre and Primary Teacher Training">Partnership</option>
|
||||||
<option value="Montessori Teacher Training">Joint Montessori Network</option>
|
<option value="Montessori Teacher Training">Joint Montessori Network</option>
|
||||||
<option value="Pre and Primary Teacher Training">Other</option>
|
<option value="Pre and Primary Teacher Training">Other</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>-->
|
||||||
|
|
||||||
<div class="form-group mb-7 mb-md-9">
|
<div class="form-group mb-7 mb-md-9">
|
||||||
|
|
||||||
<!-- Input -->
|
<!-- Input -->
|
||||||
<textarea class="form-control" name="widget-contact-form-message" id="message" rows="3"
|
<textarea type="text" name="widget-contact-form-message" required rows="3"
|
||||||
placeholder="Tell us what we can help you with!"></textarea>
|
class="form-control required" id="message" placeholder="Enter your Message"></textarea>
|
||||||
|
|
||||||
|
|
||||||
</div> <!-- / .row -->
|
</div> <!-- / .row -->
|
||||||
|
<!--
|
||||||
<div class="form-group mb-5 d-none">
|
<div class="form-group mb-5 d-none">
|
||||||
|
|
||||||
<!-- Label -->
|
<!-- Label --
|
||||||
<label for="contactMessage">
|
<label for="contactMessage">
|
||||||
What can we help you with?
|
What can we help you with?
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<!-- Input -->
|
<!-- Input --
|
||||||
<textarea class="form-control" id="message" rows="5"
|
<textarea class="form-control" id="message" rows="5"
|
||||||
placeholder="Tell us what we can help you with!"></textarea>
|
placeholder="Tell us what we can help you with!"></textarea>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
<div class="form-group mb-0">
|
<div class="form-group mb-0">
|
||||||
|
|
||||||
<!-- Submit --
|
<!-- Submit --
|
||||||
@@ -151,7 +167,6 @@ include("_navbar.php");
|
|||||||
</a>-->
|
</a>-->
|
||||||
|
|
||||||
<button style="background-color: #f7a325;margin:10px;" class="btn btn-sm btn-block lift" type="button" onclick="submitForm()"> Send message</button>
|
<button style="background-color: #f7a325;margin:10px;" class="btn btn-sm btn-block lift" type="button" onclick="submitForm()"> Send message</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -159,138 +174,138 @@ include("_navbar.php");
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var option= null;
|
var option = null;
|
||||||
var name= null;
|
var name = null;
|
||||||
var addr= null;
|
var addr = null;
|
||||||
var phn= null;
|
var phn = null;
|
||||||
var subject = null;
|
var subject = null;
|
||||||
var email= null;
|
var email = null;
|
||||||
var message= null;
|
var message = null;
|
||||||
var warning = document.getElementById('warning');
|
var warning = document.getElementById('warning');
|
||||||
var success = document.getElementById('success');
|
var success = document.getElementById('success');
|
||||||
var emailError = document.getElementById('emailError');
|
var emailError = document.getElementById('emailError');
|
||||||
var req = document.getElementById("req");
|
var req = document.getElementById("req");
|
||||||
function setOptions(s) {
|
function setOptions(s) {
|
||||||
// console.log(s[s.selectedIndex].value); // get value
|
// console.log(s[s.selectedIndex].value); // get value
|
||||||
option = s[s.selectedIndex].value;
|
option = s[s.selectedIndex].value;
|
||||||
// console.log(s[s.selectedIndex].id); // get id
|
// console.log(s[s.selectedIndex].id); // get id
|
||||||
}
|
}
|
||||||
function submitForm(){
|
function submitForm() {
|
||||||
name = document.getElementById("name1").value;
|
name = document.getElementById("name1").value;
|
||||||
phn = document.getElementById("phn").value;
|
phn = document.getElementById("phn").value;
|
||||||
addr = document.getElementById("addr").value;
|
addr = document.getElementById("addr").value;
|
||||||
email = document.getElementById("email").value;
|
email = document.getElementById("email").value;
|
||||||
message = document.getElementById("message").value;
|
message = document.getElementById("message").value;
|
||||||
success.style.display = "none";
|
success.style.display = "none";
|
||||||
subject = req.options[req.selectedIndex].text;
|
subject = req.options[req.selectedIndex].text;
|
||||||
// console.log(name+phn+addr+email+message);
|
// console.log(name+phn+addr+email+message);
|
||||||
if(name == '' || addr=='' || phn == '' || email == '' || message==''){
|
if (name == '' || addr == '' || phn == '' || email == '' || message == '') {
|
||||||
warning.style.display = "block";
|
warning.style.display = "block";
|
||||||
}else{
|
} else {
|
||||||
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
|
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
|
||||||
|
|
||||||
if (reg.test(email) == false)
|
if (reg.test(email) == false) {
|
||||||
{
|
emailError.style.display = "block";
|
||||||
emailError.style.display = "block";
|
} else {
|
||||||
}else{
|
emailError.style.display = "none";
|
||||||
emailError.style.display = "none";
|
warning.style.display = "none";
|
||||||
warning.style.display = "none";
|
let formData = new FormData();
|
||||||
let formData = new FormData();
|
formData.append('formName', 'iimttNewContact');
|
||||||
formData.append('formName', 'teenyBeansNewContact');
|
formData.append('Name', name);
|
||||||
formData.append('Name', name);
|
formData.append('Email', email);
|
||||||
formData.append('Email', email);
|
formData.append('Phone', phn);
|
||||||
formData.append('Phone', phn);
|
// formData.append('Address', addr);
|
||||||
// formData.append('Address', addr);
|
formData.append('MessageDetails', message + " Subject= " + subject);
|
||||||
formData.append('MessageDetails', message+" Subject= "+subject);
|
fetch('https://api.teenybeans.in/API/contactFormProcessor/v1/', {
|
||||||
fetch('https://api.teenybeans.in/API/contactFormProcessor/v1/', {
|
method: 'POST',
|
||||||
method: 'POST',
|
body: formData
|
||||||
body: formData
|
})
|
||||||
})
|
.then(res => res.json())
|
||||||
.then(res => res.json())
|
.then(json => {
|
||||||
.then(json => {
|
// console.log(json);
|
||||||
// console.log(json);
|
// sendMail("enquiry@atheneumglobal.education");
|
||||||
// sendMail("enquiry@atheneumglobal.education");
|
sendMail("teenybeans.info@gmail.com");
|
||||||
sendMail("enquiry@beanstalkedu.com");
|
sendMail("enquiry@beanstalkedu.com");
|
||||||
sendMail("teenybeans.info@gmail.com");
|
sendMail("enquiry@iimtt.org");
|
||||||
// sendMail("chatterjeegouravking@gmail.com");
|
// sendMail("chatterjeegouravking@gmail.com");
|
||||||
sendWelcomeMail(email);
|
sendWelcomeMail(email);
|
||||||
success.style.display = "block";
|
success.style.display = "block";
|
||||||
document.getElementById("name1").value="";
|
document.getElementById("name1").value = "";
|
||||||
document.getElementById("phn").value="";
|
document.getElementById("phn").value = "";
|
||||||
document.getElementById("addr").value="";
|
document.getElementById("addr").value = "";
|
||||||
document.getElementById("email").value="";
|
document.getElementById("email").value = "";
|
||||||
document.getElementById("message").value="";
|
document.getElementById("message").value = "";
|
||||||
|
|
||||||
// window.location.href = "contact-back";
|
// window.location.href = "contact-back";
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// if(name)
|
// if(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sendMail(sendEmail) {
|
||||||
|
// ---------Mail sent-----------------
|
||||||
|
|
||||||
|
let formData = new FormData();
|
||||||
|
formData.append("sendMail", "true");
|
||||||
|
formData.append("reciever", sendEmail);
|
||||||
|
formData.append("sender", "IIMTT");
|
||||||
|
formData.append("senderMail", "enquiry@iimtt.org");
|
||||||
|
formData.append("subject", "New Contact Form Fillup");
|
||||||
|
formData.append(
|
||||||
|
"message",
|
||||||
|
"<html><body><p>New Contact form is filled up.</p><br><p>User Details:-</p><table><tr><th>Name:- </th><td>:- " +
|
||||||
|
name +
|
||||||
|
"</td></tr><tr><th>Email:- </th><td>:- " +
|
||||||
|
email +
|
||||||
|
"</td></tr><tr><th>Phone:- </th><td>:- " +
|
||||||
|
phn +
|
||||||
|
"</td></tr><tr><th>Message:- </th><td>:- " +
|
||||||
|
message +
|
||||||
|
"</td></tr></table></body></html>"
|
||||||
|
);
|
||||||
|
fetch("https://mailapi.teenybeans.in/", {
|
||||||
|
method: "POST",
|
||||||
|
body: formData
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
response.json().then(function (data) {
|
||||||
|
// console.log(data);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(function (err) {
|
||||||
|
console.log("Fetch Error :-S", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function sendWelcomeMail(sendEmail) {
|
||||||
|
// ---------Mail sent-----------------
|
||||||
|
console.log(sendEmail);
|
||||||
|
let formData = new FormData();
|
||||||
|
formData.append("sendMail", "true");
|
||||||
|
formData.append("reciever", sendEmail);
|
||||||
|
formData.append("sender", "IIMTT");
|
||||||
|
formData.append("senderMail", "enquiry@iimtt.org");
|
||||||
|
formData.append("subject", "Welcome to IIMTT");
|
||||||
|
formData.append(
|
||||||
|
"message",
|
||||||
|
"<html><body><p>Welcome " +
|
||||||
|
name +
|
||||||
|
" to IIMTT.<br>Thank you for contacting us. <br> We will get back to you shortly. In the meanwhile please do check out our website for more information. click <a href='https://iimtt.org'>here</a><br>Thank you<br>-Team IIMTT. </p></body></html>"
|
||||||
|
);
|
||||||
|
fetch("https://mailapi.teenybeans.in/", {
|
||||||
|
method: "POST",
|
||||||
|
body: formData
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
response.json().then(function (data) {
|
||||||
|
console.log(data);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(function (err) {
|
||||||
|
console.log("Fetch Error :-S", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function sendMail(sendEmail) {
|
|
||||||
// ---------Mail sent-----------------
|
|
||||||
|
|
||||||
let formData = new FormData();
|
|
||||||
formData.append("sendMail", "true");
|
|
||||||
formData.append("reciever", sendEmail);
|
|
||||||
formData.append("sender", "Teenybeans");
|
|
||||||
formData.append("senderMail", "no-reply@teenybeans.in");
|
|
||||||
formData.append("subject", "New Contact Form Fillup");
|
|
||||||
formData.append(
|
|
||||||
"message",
|
|
||||||
"<html><body><p>New Contact form is filled up.</p><br><p>User Details:-</p><table><tr><th>Name:- </th><td>:- " +
|
|
||||||
name +
|
|
||||||
"</td></tr><tr><th>Email:- </th><td>:- " +
|
|
||||||
email +
|
|
||||||
"</td></tr><tr><th>Phone:- </th><td>:- " +
|
|
||||||
phn +
|
|
||||||
"</td></tr><tr><th>Message:- </th><td>:- " +
|
|
||||||
message +
|
|
||||||
"</td></tr></table></body></html>"
|
|
||||||
);
|
|
||||||
fetch("https://mailapi.teenybeans.in/", {
|
|
||||||
method: "POST",
|
|
||||||
body: formData
|
|
||||||
})
|
|
||||||
.then(function(response) {
|
|
||||||
response.json().then(function(data) {
|
|
||||||
// console.log(data);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(function(err) {
|
|
||||||
console.log("Fetch Error :-S", err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function sendWelcomeMail(sendEmail) {
|
|
||||||
// ---------Mail sent-----------------
|
|
||||||
console.log(sendEmail);
|
|
||||||
let formData = new FormData();
|
|
||||||
formData.append("sendMail", "true");
|
|
||||||
formData.append("reciever", sendEmail);
|
|
||||||
formData.append("sender", "Teenybeans");
|
|
||||||
formData.append("senderMail", "no-reply@teenybeans.in");
|
|
||||||
formData.append("subject", "Welcome to Teenybeans Preschool");
|
|
||||||
formData.append(
|
|
||||||
"message",
|
|
||||||
"<html><body><p>Welcome " +
|
|
||||||
name +
|
|
||||||
" to Teenybeans Preschool.<br>Thank you for contacting us. <br> We will get back to you shortly. In the meanwhile please do check out our website for more information. click <a href='https://teenybeans.in'>here</a><br>Thank you<br>-Team Teenybeans. </p></body></html>"
|
|
||||||
);
|
|
||||||
fetch("https://mailapi.teenybeans.in/", {
|
|
||||||
method: "POST",
|
|
||||||
body: formData
|
|
||||||
})
|
|
||||||
.then(function(response) {
|
|
||||||
response.json().then(function(data) {
|
|
||||||
console.log(data);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(function(err) {
|
|
||||||
console.log("Fetch Error :-S", err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -233,11 +233,14 @@ include("_navbar.php");
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="alert alert-danger" id="warning" style="display: none;">Fill all the fields!</div>
|
||||||
|
<div class="alert alert-success" id="success" style="display: none;">Thank You! We will contact you soon!</div>
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<div class="form-group mb-5">
|
<div class="form-group mb-5">
|
||||||
|
|
||||||
<!-- Input -->
|
<!-- Input -->
|
||||||
<input class="form-control" id="contactName" type="text" placeholder="Full Name" required>
|
<input type="text" aria-required="true" name="widget-contact-form-name" required
|
||||||
|
class="form-control required name" id="name1" placeholder="Enter your Name">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -245,16 +248,27 @@ include("_navbar.php");
|
|||||||
<div class="form-group mb-5">
|
<div class="form-group mb-5">
|
||||||
|
|
||||||
<!-- Input -->
|
<!-- Input -->
|
||||||
<input class="form-control" id="contactEmail" type="number" placeholder="Phone Number" required>
|
<input class="form-control" id="phn" type="number" name="telephone"
|
||||||
|
placeholder="Contact number" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-12">
|
<div class="col-12 col-md-12">
|
||||||
<div class="form-group mb-5">
|
<div class="form-group mb-5">
|
||||||
|
|
||||||
<!-- Input -->
|
<!-- Input -->
|
||||||
<input class="form-control" id="contactEmail" type="email" placeholder="hello@domain.com" required>
|
<input type="email" id="email" aria-required="true" name="widget-contact-form-email"
|
||||||
|
required class="form-control required email" placeholder="Enter your Email">
|
||||||
|
<p id="emailError" style="color: red; display: none;">Enter a valid email address</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<select id="req" class="form-control" name="gender" required>
|
||||||
|
<option value="">---Select Course Name---</option>
|
||||||
|
<option>Graduate Diploma in Montessori Teacher Training.</option>
|
||||||
|
<option>Post-graduate Diploma in Montessori Teacher Training.</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<!--
|
||||||
<div class="col-12 col-md-12">
|
<div class="col-12 col-md-12">
|
||||||
<div class="form-group mb-5">
|
<div class="form-group mb-5">
|
||||||
<select class="form-control" name="cars" id="cars" required>
|
<select class="form-control" name="cars" id="cars" required>
|
||||||
@@ -263,23 +277,20 @@ include("_navbar.php");
|
|||||||
<option value="Pre and Primary Teacher Training">Post-graduate Diploma in Montessori Teacher Training.</option>
|
<option value="Pre and Primary Teacher Training">Post-graduate Diploma in Montessori Teacher Training.</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
</div>-->
|
||||||
|
</div> <!-- / .row -->
|
||||||
|
<div class="form-group mb-7 mb-md-9">
|
||||||
|
|
||||||
|
<!-- Input -->
|
||||||
|
<textarea type="text" name="widget-contact-form-message" required rows="2"
|
||||||
|
class="form-control required" id="message" placeholder="Enter your Message"></textarea>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- / .row -->
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="form-group">
|
|
||||||
|
|
||||||
<!-- Input -->
|
|
||||||
<textarea class="form-control" id="contactMessage" rows="2" placeholder="Message"></textarea>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> <!-- / .row -->
|
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
|
|
||||||
<!-- Submit -->
|
<!-- Submit -->
|
||||||
<button type="submit" class="btn bt">
|
<button type="submit" class="btn bt" onclick="submitForm()">
|
||||||
Send message
|
Send message
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -290,4 +301,139 @@ include("_navbar.php");
|
|||||||
</div>
|
</div>
|
||||||
</div> <!-- / .row -->
|
</div> <!-- / .row -->
|
||||||
</div> <!-- / .container -->
|
</div> <!-- / .container -->
|
||||||
</section>
|
</section>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var option = null;
|
||||||
|
var name = null;
|
||||||
|
var phn = null;
|
||||||
|
var subject = null;
|
||||||
|
var email = null;
|
||||||
|
var message = null;
|
||||||
|
var warning = document.getElementById('warning');
|
||||||
|
var success = document.getElementById('success');
|
||||||
|
var emailError = document.getElementById('emailError');
|
||||||
|
var req = document.getElementById("req");
|
||||||
|
function setOptions(s) {
|
||||||
|
// console.log(s[s.selectedIndex].value); // get value
|
||||||
|
option = s[s.selectedIndex].value;
|
||||||
|
// console.log(s[s.selectedIndex].id); // get id
|
||||||
|
}
|
||||||
|
function submitForm() {
|
||||||
|
name = document.getElementById("name1").value;
|
||||||
|
phn = document.getElementById("phn").value;
|
||||||
|
email = document.getElementById("email").value;
|
||||||
|
message = document.getElementById("message").value;
|
||||||
|
success.style.display = "none";
|
||||||
|
subject = req.options[req.selectedIndex].text;
|
||||||
|
// console.log(name+phn+email+message);
|
||||||
|
if (name == '' || phn == '' || email == '' || message == '') {
|
||||||
|
warning.style.display = "block";
|
||||||
|
} else {
|
||||||
|
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
|
||||||
|
|
||||||
|
if (reg.test(email) == false) {
|
||||||
|
emailError.style.display = "block";
|
||||||
|
} else {
|
||||||
|
emailError.style.display = "none";
|
||||||
|
warning.style.display = "none";
|
||||||
|
let formData = new FormData();
|
||||||
|
formData.append('formName', 'iimttNewContact');
|
||||||
|
formData.append('Name', name);
|
||||||
|
formData.append('Email', email);
|
||||||
|
formData.append('Phone', phn);
|
||||||
|
// formData.append('Address', addr);
|
||||||
|
formData.append('MessageDetails', message + " Subject= " + subject);
|
||||||
|
fetch('https://api.teenybeans.in/API/contactFormProcessor/v1/', {
|
||||||
|
method: 'POST',
|
||||||
|
body: formData
|
||||||
|
})
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(json => {
|
||||||
|
// console.log(json);
|
||||||
|
// sendMail("enquiry@atheneumglobal.education");
|
||||||
|
sendMail("teenybeans.info@gmail.com");
|
||||||
|
sendMail("enquiry@beanstalkedu.com");
|
||||||
|
sendMail("enquiry@iimtt.org");
|
||||||
|
sendMail("nairobi@iimtt.org");
|
||||||
|
// sendMail("chatterjeegouravking@gmail.com");
|
||||||
|
sendWelcomeMail(email);
|
||||||
|
success.style.display = "block";
|
||||||
|
document.getElementById("name1").value = "";
|
||||||
|
document.getElementById("phn").value = "";
|
||||||
|
document.getElementById("email").value = "";
|
||||||
|
document.getElementById("message").value = "";
|
||||||
|
|
||||||
|
// window.location.href = "contact-back";
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// if(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendMail(sendEmail) {
|
||||||
|
// ---------Mail sent-----------------
|
||||||
|
|
||||||
|
let formData = new FormData();
|
||||||
|
formData.append("sendMail", "true");
|
||||||
|
formData.append("reciever", sendEmail);
|
||||||
|
formData.append("sender", "IIMTT");
|
||||||
|
formData.append("senderMail", "enquiry@iimtt.org");
|
||||||
|
formData.append("subject", "New Contact Form Fillup");
|
||||||
|
formData.append(
|
||||||
|
"message",
|
||||||
|
"<html><body><p>New Contact form is filled up.</p><br><p>User Details:-</p><table><tr><th>Name:- </th><td>:- " +
|
||||||
|
name +
|
||||||
|
"</td></tr><tr><th>Email:- </th><td>:- " +
|
||||||
|
email +
|
||||||
|
"</td></tr><tr><th>Phone:- </th><td>:- " +
|
||||||
|
phn +
|
||||||
|
"</td></tr><tr><th>Message:- </th><td>:- " +
|
||||||
|
message +
|
||||||
|
"</td></tr></table></body></html>"
|
||||||
|
);
|
||||||
|
fetch("https://mailapi.teenybeans.in/", {
|
||||||
|
method: "POST",
|
||||||
|
body: formData
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
response.json().then(function (data) {
|
||||||
|
// console.log(data);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(function (err) {
|
||||||
|
console.log("Fetch Error :-S", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function sendWelcomeMail(sendEmail) {
|
||||||
|
// ---------Mail sent-----------------
|
||||||
|
console.log(sendEmail);
|
||||||
|
let formData = new FormData();
|
||||||
|
formData.append("sendMail", "true");
|
||||||
|
formData.append("reciever", sendEmail);
|
||||||
|
formData.append("sender", "IIMTT");
|
||||||
|
formData.append("senderMail", "enquiry@iimtt.org");
|
||||||
|
formData.append("subject", "Welcome to IIMTT");
|
||||||
|
formData.append(
|
||||||
|
"message",
|
||||||
|
"<html><body><p>Welcome " +
|
||||||
|
name +
|
||||||
|
" to IIMTT.<br>Thank you for contacting us. <br> We will get back to you shortly. In the meanwhile please do check out our website for more information. click <a href='https://iimtt.org'>here</a><br>Thank you<br>-Team IIMTT. </p></body></html>"
|
||||||
|
);
|
||||||
|
fetch("https://mailapi.teenybeans.in/", {
|
||||||
|
method: "POST",
|
||||||
|
body: formData
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
response.json().then(function (data) {
|
||||||
|
console.log(data);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(function (err) {
|
||||||
|
console.log("Fetch Error :-S", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user