jQuery(document).ready(function ($) {
// Contact forms validation
//———————————————–
if( $(“#contact-form”).length>0 ){
$(“#contact-form”).validate({
submitHandler: function(form) {
var submitButton = $(this.submitButton);
submitButton.button(“loading”);
$.ajax({
type: “POST”,
url: “http://thomascommunicationsinc.com/wp-content/themes/everglades/framework-customizations/theme/shortcodes/contact-form/contact-form.php”,
data: {
“name”: $(“#contact-form #name”).val(),
“email”: $(“#contact-form #email”).val(),
“subject”: $(“#contact-form #subject”).val(),
“message”: $(“#contact-form #message”).val(),
“emailTo”: $(“#contact-form #emailTo”).val()
},
dataType: “json”,
success: function (data) {
if (data.response == “success”) {
$(“#contactSuccess”).removeClass(“hidden”);
$(“#contactError”).addClass(“hidden”);
// Reset Form
$(“#contact-form .form-control”)
.val(“”)
.blur()
.parent()
.removeClass(“has-success”)
.removeClass(“has-error”)
.find(“label.error”)
.remove();
if(($(“#contactSuccess”).position().top – 80) < $(window).scrollTop()){
$(“html, body”).animate({
scrollTop: $(“#contactSuccess”).offset().top – 80
}, 300);
}
} else {
$(“#contactError”).removeClass(“hidden”);
$(“#contactSuccess”).addClass(“hidden”);
if(($(“#contactError”).position().top – 80) < $(window).scrollTop()){
$(“html, body”).animate({
scrollTop: $(“#contactError”).offset().top – 80
}, 300);
}
}
},
complete: function () {
submitButton.button(“reset”);
}
});
},
// debug: true,
errorPlacement: function(error, element) {
error.insertBefore( element );
},
onkeyup: false,
onclick: false,
rules: {
name: {
required: true,
minlength: 2
},
email: {
required: true,
email: true
},
subject: {
required: true
},
message: {
required: true,
minlength: 10
}
},
messages: {
name: {
required: Please specify your name,
minlength: Your name must be longer than 2 characters },
email: {
required: We need your email address to contact you,
email: Please enter a valid email address e.g. name@domain.com },
subject: {
required: Please enter a subject },
message: {
required: Please enter a message,
minlength: Your message must be longer than 10 characters }
},
errorElement: “span”,
highlight: function (element) {
$(element).parent().removeClass(“has-success”).addClass(“has-error”);
$(element).siblings(“label”).addClass(“hide”);
},
success: function (element) {
$(element).parent().removeClass(“has-error”).addClass(“has-success”);
$(element).siblings(“label”).removeClass(“hide”);
}
});
}
});
Success! Your message has been sent to us.
Error! There was an error sending your message.
Name*
Email*
Subject*
Message*

Thomas Communications, Inc.

 

The BDA Professional Building

Suite 105

200 Abington Executive Park

Clarks Summit, PA 18411

Phone: (570) 586-5707

Fax: (570) 586-5344

Email: jft@thomascom.net