If you do Recaptcha on a callback
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
using an empty div as a placeholder
<div id='html_element'></div>
then you can specify an optional function call on a successful CAPTCHA response
var onloadCallback = function() { grecaptcha.render('html_element', { 'sitekey' : 'your_site_key', 'callback' : correctCaptcha }); };
Then the recaptcha response is returned to the "correctCaptcha" function.
var correctCaptcha = function(response) { alert(response); };
All this was from the Google API notes:
Google Recaptcha v2 API Notes
I'm a little unsure why you want to do this. Usually you send the g-recaptcha-response field along with your private key to securely check the server side. If you do not want to disable the submit button until the recaptcha is successful or not, then the above should work.
Hope this helps.
Floor
pphillips001 Jan 20 '15 at 11:49 2015-01-20 11:49
source share