How to Reload ReCaptcha using JavaScript?
I have a signup form with AJAX so that I want to refresh Recaptcha image anytime an error is occured (ie username already in use).
I am looking for a code compatible with ReCaptcha to reload it using JavaScript.
I think I can answer my own question now. It is
Recaptcha.reload();
in JavaScript if there is an already loaded Recaptcha on the window.
Edit: @SebiH updated that this command is now:
grecaptcha.reset();
If you are using version 1
Recaptcha.reload();
If you are using version 2
grecaptcha.reset();
或者你可以模拟点击刷新按钮
// If recaptcha object exists, refresh it
if (typeof Recaptcha != "undefined") {
jQuery('#recaptcha_reload').click();
}
链接地址: http://www.djcxy.com/p/21624.html
上一篇: 打败CAPTCHA搭桥的策略