jquery - google captcha invisible, validation -


when add ajax captcha checking form validation script, neither validation nor captcha works now. can should mistake?

   jquery(document).ready(function($) {     $('.myform').submit(function() {         var forminputs = $(this).find('.validate');         var errors = '';             $(forminputs).each(function() {             if($.trim(this.value) == '') {                 fieldlabel = $(this).parent().find('span.label-text').html();                 errors += '- ' + fieldlabel + '\n'; }         $.ajax({        type: "post",        url: "/recaptcha.php",        data: form.serialize(),        datatype: "json",         error:function(){            grecaptcha.reset(); },        success:function(result){          if(errors.length > 0) {             alert('you didn't fill:\n\n' + errors);             return false;          }else{  $('.submit-button').val('sending');                  $('.submit-button').attr('disabled', 'disabled');             return true;                   }          }  

});

recaptcha.php

<?php if(isset($_post['g-recaptcha-response'])) {     $secretkey = '6l---4oyg';     $response = $_post['g-recaptcha-response'];          $remoteip = $_server['remote_addr'];     $recaptchavalidationurl = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secretkey&response=$response&remoteip=$remoteip");     $result = json_decode($recaptchavalidationurl, true);     print_r($result);      if($result['success'] == 1) {         $usermessage = '<div>success: you\'ve made :)</div>';     } else {         $usermessage = '<div>fail: please try again :(</div>';     } } ?> 


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -