Integrating reCAPTCHA with existing PHP script

dreamer29

New Member
I have a php script which uses the following line to submit a form :\[code\]<form action = "javascript:void(null);" onsubmit = "load_ajax();" name = "myform">\[/code\]Now, to protect bots from misusing the form I want to implement reCAPTCHA as described here :\[code\]http://www.darksideofthecarton.com/2008/12/15/validating-recaptcha-with-jquery-and-ajax/\[/code\]The reCAPTCHA logic is working fine displaying verification Success/Fail message but the form is not getting submitted. Here is the code I am using to implement reCAPTCHA :\[code\]<form action = "javascript:void(null);" onsubmit = "return validateCaptcha()" name = "myform">\[/code\]Validation part which I am using to call my load_ajax() function (which denotes successful form submission) :\[code\] function validateCaptcha(){ challengeField = $("input#recaptcha_challenge_field").val(); responseField = $("input#recaptcha_response_field").val(); //alert(challengeField); //alert(responseField); //return false; var html = $.ajax({ type: "POST", url: "ajax.recaptcha.php", data: "recaptcha_challenge_field=" + challengeField + "&recaptcha_response_field=" + responseField, async: false }).responseText; if(html == "success") { $("#captchaStatus").html("Success. Submitting form."); return false; // Uncomment the following line in your application load_ajax(); return true; } else { $("#captchaStatus").html("Image verification failed, Pls. enter the image verification code correctly."); Recaptcha.reload(); return false; }}</script>\[/code\]I am not a php/javascript expert so help is needed.Thanks
 
Back
Top