|
|
|
@@ -37,18 +37,19 @@ jQuery(document).ready(function($){ |
|
|
|
var button = $("#contact-form #submit"); |
|
|
|
var status = $(".log"); |
|
|
|
|
|
|
|
function success(){ |
|
|
|
function success(data){ |
|
|
|
//form.reset(); |
|
|
|
form.css('display', 'block!important'); |
|
|
|
//form.css('display', 'block!important'); |
|
|
|
//button.style = "display: none "; |
|
|
|
status.addClass("successfully").text("Thanks!"); |
|
|
|
form.append(xhr.response); |
|
|
|
} |
|
|
|
|
|
|
|
function error() { |
|
|
|
status.addClass("error").text("Oops! There was a problem."); |
|
|
|
//status.addClass("error").text("Oops! There was a problem."); |
|
|
|
form.append(xhr.response); |
|
|
|
} |
|
|
|
|
|
|
|
button.on("click", function(ev) { |
|
|
|
button.on("submit", function(ev) { |
|
|
|
//ev.preventDefault(); |
|
|
|
//button.style = "display: none "; |
|
|
|
var data = new FormData(form); |
|
|
|
@@ -69,6 +70,7 @@ jQuery(document).ready(function($){ |
|
|
|
if (xhr.readyState !== XMLHttpRequest.DONE) return; |
|
|
|
if (xhr.status === 200) { |
|
|
|
success(); |
|
|
|
|
|
|
|
} else { |
|
|
|
error(); |
|
|
|
} |
|
|
|
@@ -323,71 +325,71 @@ jQuery(document).ready(function($){ |
|
|
|
return pattern.test(emailAddress); |
|
|
|
} |
|
|
|
|
|
|
|
$('.contact-form form').submit(function() { |
|
|
|
// $('.contact-form form').submit(function() { |
|
|
|
|
|
|
|
var hasError = false; |
|
|
|
// var hasError = false; |
|
|
|
|
|
|
|
var comment = $('#message-txt').val(); |
|
|
|
if ($.trim(comment) == '') { |
|
|
|
$('#message-txt').addClass('error'); |
|
|
|
$('#message-txt').focus(); |
|
|
|
hasError = true; |
|
|
|
} |
|
|
|
else { |
|
|
|
$('#message-txt').removeClass('error'); |
|
|
|
} |
|
|
|
|
|
|
|
var subject = $('#subject-txt').val(); |
|
|
|
if ($.trim(subject) == '') { |
|
|
|
$('#subject-txt').addClass('error'); |
|
|
|
$('#subject-txt').focus(); |
|
|
|
hasError = true; |
|
|
|
} |
|
|
|
else { |
|
|
|
$('#subject-txt').removeClass('error'); |
|
|
|
} |
|
|
|
// var comment = $('#message-txt').val(); |
|
|
|
// if ($.trim(comment) == '') { |
|
|
|
// $('#message-txt').addClass('error'); |
|
|
|
// $('#message-txt').focus(); |
|
|
|
// hasError = true; |
|
|
|
// } |
|
|
|
// else { |
|
|
|
// $('#message-txt').removeClass('error'); |
|
|
|
// } |
|
|
|
|
|
|
|
// var subject = $('#subject-txt').val(); |
|
|
|
// if ($.trim(subject) == '') { |
|
|
|
// $('#subject-txt').addClass('error'); |
|
|
|
// $('#subject-txt').focus(); |
|
|
|
// hasError = true; |
|
|
|
// } |
|
|
|
// else { |
|
|
|
// $('#subject-txt').removeClass('error'); |
|
|
|
// } |
|
|
|
|
|
|
|
var emailVal = $('#email-txt').val(); |
|
|
|
if ($.trim(emailVal) == '' || !isValidEmailAddress(emailVal)) { |
|
|
|
$('#email-txt').addClass('error'); |
|
|
|
$('#email-txt').focus(); |
|
|
|
hasError = true; |
|
|
|
} |
|
|
|
else { |
|
|
|
$('#email-txt').removeClass('error'); |
|
|
|
} |
|
|
|
// var emailVal = $('#email-txt').val(); |
|
|
|
// if ($.trim(emailVal) == '' || !isValidEmailAddress(emailVal)) { |
|
|
|
// $('#email-txt').addClass('error'); |
|
|
|
// $('#email-txt').focus(); |
|
|
|
// hasError = true; |
|
|
|
// } |
|
|
|
// else { |
|
|
|
// $('#email-txt').removeClass('error'); |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
var name = $('#name-txt').val(); |
|
|
|
if ($.trim(name) == '') { |
|
|
|
$('#name-txt').addClass('error'); |
|
|
|
$('#name-txt').focus(); |
|
|
|
hasError = true; |
|
|
|
// var name = $('#name-txt').val(); |
|
|
|
// if ($.trim(name) == '') { |
|
|
|
// $('#name-txt').addClass('error'); |
|
|
|
// $('#name-txt').focus(); |
|
|
|
// hasError = true; |
|
|
|
|
|
|
|
} |
|
|
|
else { |
|
|
|
$('#name-txt').removeClass('error'); |
|
|
|
} |
|
|
|
// } |
|
|
|
// else { |
|
|
|
// $('#name-txt').removeClass('error'); |
|
|
|
// } |
|
|
|
|
|
|
|
if (!hasError) { |
|
|
|
$('#submit').fadeOut('normal', function(){ |
|
|
|
$('.loading').css({ |
|
|
|
display: "block" |
|
|
|
}); |
|
|
|
// if (!hasError) { |
|
|
|
// $('#submit').fadeOut('normal', function(){ |
|
|
|
// $('.loading').css({ |
|
|
|
// display: "block" |
|
|
|
// }); |
|
|
|
|
|
|
|
}); |
|
|
|
// }); |
|
|
|
|
|
|
|
$.post($('.contact-form form').attr('action'), $('.contact-form form').serialize(), function(data){ |
|
|
|
$('.log').html(data); |
|
|
|
$('.loading').remove(); |
|
|
|
$('.contact-form form').slideUp('slow'); |
|
|
|
}); |
|
|
|
// // $.post($('.contact-form form').attr('action'), $('.contact-form form').serialize(), function(data){ |
|
|
|
// // $('.log').html(data); |
|
|
|
// // $('.loading').remove(); |
|
|
|
// // $('.contact-form form').slideUp('slow'); |
|
|
|
// // }); |
|
|
|
|
|
|
|
} |
|
|
|
// } |
|
|
|
|
|
|
|
return false; |
|
|
|
// return false; |
|
|
|
|
|
|
|
}); |
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
|
|
|