Help with Form to email
I have a template that I have been modifying. I am not experienced but need help. what do i need to edit to get it to submit to my email?
This is the js script for the form.
// Contact Form Submition
function checkRequire(formId, targetResp) {
targetResp.html('');
var email = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
var url = /(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/;
var image = /\.(jpe?g|gif|png|PNG|JPE?G)$/;
var mobile = /^[\s()+-]*([0-9][\s()+-]*){6,20}$/;
var facebook = /^(https?:\/\/)?(www\.)?facebook.com\/[a-zA-Z0-9(\.\?)?]/;
var twitter = /^(https?:\/\/)?(www\.)?twitter.com\/[a-zA-Z0-9(\.\?)?]/;
var google_plus = /^(https?:\/\/)?(www\.)?plus.google.com\/[a-zA-Z0-9(\.\?)?]/;
var check = 0;
$('#er_msg').remove();
var target = (typeof formId == 'object') ? $(formId) : $('#' + formId);
target.find('input , textarea , select').each(function() {
if ($(this).hasClass('require')) {
if ($(this).val().trim() == '') {
check = 1;
$(this).focus();
targetResp.html('You missed out some fields.');
$(this).addClass('error');
return false;
} else {
$(this).removeClass('error');
}
}
if ($(this).val().trim() != '') {
var valid = $(this).attr('data-valid');
if (typeof valid != 'undefined') {
if (!eval(valid).test($(this).val().trim())) {
$(this).addClass('error');
$(this).focus();
check = 1;
targetResp.html($(this).attr('data-error'));
return false;
} else {
$(this).removeClass('error');
}
}
}
});
return check;
}
$(".submitForm").on("click", function() {
var _this = $(this);
var targetForm = _this.closest('form');
var errroTarget = targetForm.find('.response');
var check = checkRequire(targetForm, errroTarget);
if (check == 0) {
var formDetail = new FormData(targetForm[0]);
formDetail.append('form_type', _this.attr('form-type'));
$.ajax({
method: 'post',
url: 'ajax.php',
data: formDetail,
cache: false,
contentType: false,
processData: false
}).done(function(resp) {
if (resp == 1) {
targetForm.find('input').val('');
targetForm.find('textarea').val('');
errroTarget.html('<p style="color:green;">Mail has been sent successfully.</p>');
} else {
errroTarget.html('<p style="color:red;">Something went wrong please try again latter.</p>');
}
});
}
});
});
})(jQuery);
This is the html for it
<!--pst form wrapper start -->
<div class="single_contact_form_wrapper pst_toppadder50 pst_bottompadder0">
<div class="container">
<div class="row">
<div class="pst_form_control">
<div class="pst_single_forms"><input type="text" placeholder="Name" /><i class="fa fa-user"></i></div>
</div>
<div class="pst_form_control pst_form_control_2">
<div class="pst_single_forms"><input type="email" placeholder="Email" /><i class="fa fa-envelope"></i></div>
</div>
<div class="pst_form_control">
<div class="pst_single_forms"><input type="text" placeholder="Zip Code" /><i class="fa fa-star"></i></div>
</div>
<div class="pst_form_control">
<div class="pst_single_forms pst_form_control_2"><input type="text" placeholder="Phone" /><i class="fa fa-phone"></i></div>
</div>
<div class="pst_btn_form">
<ul>
<li>
<a href="#" class="tem-btn">
<div class="btn-front">submit</div>
<div class="btn-back">submit</div>
</a>
</li>
</ul>
</div>
<div class="sp_choose_heading_main_wrapper pst_bottompadder0">
<p><span><strong>Submit your interest and recieve discounts on your first cleaning!!</strong></span></p>
</div>
</div>
</div>
</div>
<div> </div>
<!--pst form wrapper end-->
