I am using ReCAPTCHA version V2. On the callback function (i.e. data-callback), I am getting the following error message.
ReCAPTCHA couldn't find user-provided function: function (response)
Now, most of the posts/solutions I see on the web are related to a local callback function that doesn't get invoked when referred in data-callback attribute of the g-recaptcha div. However, in my case, even the inline function does not get invoked. Please have a look at the following image.
In fact, when I am using JavaScript native function such as alert(), it is still not working.
Here's the JS code I am using.
<script src='https://www.google.com/recaptcha/api.js'></script>
First try - callback function:
<div class="g-recaptcha" data-sitekey="Please add your site key if you want to test" data-callback="function (response) { alert('working: ', response);}"></div>
Second try - callback function:
<div class="g-recaptcha" data-sitekey="Please add your site key if you want to test" data-callback="Window.alert('hi');"></div>
I appreciate your help if you can help me understand why is the google API responding in a completely weird way.