File: /home/demo/public_html/roofleak/assets/js/mailer.js
jQuery(document).ready(function($) {
var $feedbackContainer = $('#submitResult');
$("#submit-btn").on('click', function(){
var passedValidation = true;
//form validation
//form handling
if(passedValidation) {
//create an object with input field data to be sent to server
post_data = {
'firstname' : $('input[name=first-name]').val(),
'lastname' : $('input[name=lastname]').val(),
'email' : $('input[name=email]').val(),
'phone' : $('input[name=phone]').val(),
'zipcode' : $('select[name=zipcode]').val()
};
//AJAX for processing form
$.post( 'js/engine/process_contactForm.php',
post_data,
function(response) {
//message text
$feedbackMessage = '<p>Show whether sending the form worked</p>';
$feedbackContainer.html($feebackMessage).removeClass('hidden');
$('#contactForm').hide();
}, //end of callback
'json'
);
} //end of form handlings
}); // end of submission event
}); // end of script