Sunday, May 12, 2024
 Popular · Latest · Hot · Upcoming
168
rated 0 times [  171] [ 3]  / answers: 1 / hits: 66517  / 8 Years ago, wed, may 4, 2016, 12:00:00

I am using recaptcha with my laravel application.



I just want to check recaptcha's response on form submit using jquery and stop user by alert that pleade validate captcha.



but , I could not stop form submission even if captcha is not filled.



here is my code.



 $('#payuForm').on('submit', function (e) {

var response = grecaptcha.getResponse();

if(response.length == 0 || response == '' || response ===false ) {
alert('Please validate captcha.');
e.preventDefault();
}
});



<div class=captcha>
{{ View::make('recaptcha::display') }}
</div>


I am getting this error in browser console , and form gets submit.



Error: ReCAPTCHA placeholder element must be empty

More From » jquery

 Answers
18

You are loading the google recaptcha library twice.



https://www.google.com/recaptcha/api.js


[#62313] Sunday, May 1, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rociom

Total Points: 287
Total Questions: 88
Total Answers: 101

Location: Oman
Member since Wed, Nov 17, 2021
3 Years ago
;