I'm a bit unsure why you would want to do this. Normally you would send the g-recaptcha-response field along with your Private key to safely validate server-side. Unless you wanted to disable the submit button until the recaptcha was sucessful or such - in which case the above should work.
Hope this helps.
Paul
回答4:
Simplified Paul's answer:
Source:
HTML:
JS:
var correctCaptcha = function(response) { alert(response); };
回答5:
I used HarveyEV's solution but misread it and did it with jQuery validate instead of Bootstrap validator.
回答6:
you can render your recaptcha using following code
Then you can validate your recaptcha by using "IsRecapchaValid()" method as follows.
回答7:
I thought all of them were great but I had troubles actually getting them to work with javascript and c#. Here is what I did. Hope it helps someone else.
//put this at the top of the page //put this under the script tag //retrieved from google and added callback
//created a custom validator and added error message and ClientValidationFucntion
回答8:
I used Palek's solution inside a Bootstrap validator and it works. I'd have added a comment to his but I don'y have the rep;). Simplified version:
The Google reCAPTCHA version 2 ASP.Net allows validating the Captcha response on the client side using its Callback functions. In this example, the Google new reCAPTCHA will be validated using ASP.Net RequiredField Validator.