I can't for the life of me figure out what I'm doing wrong here. The loaded() callback should fire but does not. Here's the code for a reduced test case (with a JS fiddle link below):
<script>
function loaded() {
alert('loaded() triggered.');
}
</script>
<script src="https://www.google.com/recaptcha/api.js?onload=loaded" async defer></script>
https://jsfiddle.net/48dshrew/
ReCaptcha Documentation
Looks like the render mode needs to be set to 'explicit' for reCaptcha to call your custom onload callback function. Try this:
var onloadCallback = function() {
console.log('loaded() triggered.');
}
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit"
async defer>
</script>
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