diff --git a/js/app.js b/js/app.js index 6097878..0a6229a 100644 --- a/js/app.js +++ b/js/app.js @@ -96,25 +96,36 @@ $(document).ready(function(){ $("#detallefinan textarea").keyup(validateTextarea); $('#contactform').submit(function(event){ + var fail=false; $("#statusmsg").hide(); event.preventDefault(); - - 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); + if($('#g-recaptcha-response').val() == ""){ + $("div.g-recaptcha").tooltip({ + "title":'Marque "No soy un robot"', + "pacement":"right", + "trigger":"manual" + }); + $("div.g-recaptcha").tooltip("show"); + fail=true; + } + 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){ - console.log(error) - }); + }); + post.fail(function(error){ + console.log(error) + }); + } }); $("#detallefinan").hide(); $("#detallefinan textarea").val("");