I have a signup form with AJAX so that I want to refresh Recaptcha image anytime an error is occured (i.e. username already in use).
I am looking for a code compatible with ReCaptcha to reload it using JavaScript.
I have a signup form with AJAX so that I want to refresh Recaptcha image anytime an error is occured (i.e. username already in use).
I am looking for a code compatible with ReCaptcha to reload it using JavaScript.
Or you could just simulate a click on the refresh button
if you are using new recaptcha 2.0 use this: for code behind:
for simple javascript
Try this
If you calll showRecaptcha the captchadiv will be populated with a new recaptcha instance.
If you are using version 1
If you are using version 2
Resets the reCAPTCHA widget. An optional widget id can be passed, otherwise the function resets the first widget created. (from Google's web page)
Important: Version 1.0 of the reCAPTCHA API is no longer supported, please upgrade to Version 2.0.
You can use grecaptcha.reset(); to reset the captcha.
Source : https://developers.google.com/recaptcha/docs/verify#api-request