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?
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); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With