I'm having such a hard time with this. It seems like such a cool control, but I can't get it to work properly. I having issues with the validation piece. The widget displays and works properly, but without actually validating the response or wiring it into my button, it's worthless.
I have one button on the page. The button is actually an @Ajax.ActionLink. I can't figure out how to get the g-Recaptcha-Response, so I can pass the value to my controller ActionResult.
I also haven't been able to successfully use Javascript to validate the g-Recaptcha-Response and use it in my @Ajax.ActionLink. I have been able to display the g-Recaptcha-Response using this script, but I can't do much with it.
<script type="text/javascript">
var onReturnCallback = function (response) {
alert('g-recaptcha-response: ' + grecaptcha.getResponse());
var captchaResponse = grecaptcha.getResponse();
if (captchaResponse != null) {
document.getElementById('recaptcha').innerHTML = 'THE CAPTCHA WAS SUCCESSFULLY SOLVED';
document.getElementById('g-recaptcha-response').value=='';
}
}; // end of onReturnCallback
</script>
There seems to be very little documentation on how to use this service without using a form.
Any help is much appreciated. Thanks!