Add contact recaptcha form validation

This commit is contained in:
German Correa 2017-09-07 14:15:31 -03:00
parent 33764e2006
commit 45b34dc24f

View File

@ -96,25 +96,36 @@ $(document).ready(function(){
$("#detallefinan textarea").keyup(validateTextarea); $("#detallefinan textarea").keyup(validateTextarea);
$('#contactform').submit(function(event){ $('#contactform').submit(function(event){
var fail=false;
$("#statusmsg").hide(); $("#statusmsg").hide();
event.preventDefault(); event.preventDefault();
if($('#g-recaptcha-response').val() == ""){
var post = $.post('contact', $(this).serialize()); $("div.g-recaptcha").tooltip({
post.done(function(data){ "title":'Marque "No soy un robot"',
data = $.parseJSON(data); "pacement":"right",
if(data.success){ "trigger":"manual"
showmsg(data.message,true); });
} $("div.g-recaptcha").tooltip("show");
else{ fail=true;
showmsg(data.message,false); }
if(!fail){
var post = $.post('contact', $(this).serialize());
post.done(function(data){
data = $.parseJSON(data);
if(data.success){
showmsg(data.message,true);
}
else{
showmsg(data.message,false);
} }
console.log(data) console.log(data)
}); });
post.fail(function(error){ post.fail(function(error){
console.log(error) console.log(error)
}); });
}
}); });
$("#detallefinan").hide(); $("#detallefinan").hide();
$("#detallefinan textarea").val(""); $("#detallefinan textarea").val("");