//jQuery.noConflict(); (function ($) { $(function () { $('.error').hide(); $('input.text-input').css({backgroundColor: "#FFFFFF"}); $('input.text-input').focus(function () { $(this).css({backgroundColor: "#FFDDAA"}); }); $('input.text-input').blur(function () { $(this).css({backgroundColor: "#FFFFFF"}); }); $(".wpcf7-submit").click(function () { // validate and process form // first hide any error messages $('.error').hide(); var yourname = $("input#yourname").val(); if (yourname == "") { $("label#yourname_error").show(); $("input#yourname").focus(); return false; } var email = $("input#email").val(); if (email == "") { $("label#email_error").show(); $("input#email").focus(); return false; } var phone = $("input#phone").val(); var content = $("textarea#content").val(); if (content == "") { $("label#content_error").show(); $("content#content").focus(); return false; } if (typeof grecaptcha === "undefined"){ return false; } var response = grecaptcha.getResponse(); if( response.length === 0){ return false; } var dataString = 'yourname=' + yourname + '&email=' + email + '&phone=' + phone + '&content=' + content + "&recaptcha=" + response; $.ajax({ type: "POST", url: "bin/process-contact.php", data: dataString, dataType : 'json', success: function (data) { if( data['status'] == true ){ $('#contact_form').html("
"); $('#message').html("") .append("") .hide() .fadeIn(1000, function () { $('#message').append("
Thank you!
Message has been sent!
"); }); } else { $('#contact_form').html("
"); $('#message').html("") .append("") .hide() .fadeIn(1000, function () { $('#message').append("
We couldn't send your message
Code: "+ data['error'] +"
"); }); } } }); return false; }); }); })(jQuery);