Google ReCAPTCHA callback function not working
12,484
I haven't used it, so I don't know if this will help, but looking at the few examples online that I can find, it looks like data-callback
should be a function name, not the script body:
class='g-recaptcha' data-callback='doSomething'
function doSomething() { alert(1); }
Author by
Just some guy
Updated on June 23, 2022Comments
-
Just some guy about 2 years
I use Google's reCAPTCHA on my website and I'm having problems getting it to call a callback function. After a user has successfully passed the captcha I want to call a function. I use a div with these attributes to render the captcha:
class='g-recaptcha' data-sitekey='keyhere' data-callback='alert(1);'
However, I can't get the
alert(1);
to trigger, nothing happens when I fill out the captcha. Everything else about the captcha works fine, I just can't get it to call the function. What could I be doing wrong?