How to Reload ReCaptcha using JavaScript?

前端 未结 10 576
情深已故
情深已故 2020-12-07 09:58

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 compatib

相关标签:
10条回答
  • 2020-12-07 10:43

    If you are using version 1

    Recaptcha.reload();
    

    If you are using version 2

    grecaptcha.reset();
    
    0 讨论(0)
  • 2020-12-07 10:45

    if you are using new recaptcha 2.0 use this: for code behind:

    ScriptManager.RegisterStartupScript(this, this.GetType(), "CaptchaReload", "$.getScript(\"https://www.google.com/recaptcha/api.js\", function () {});", true);
    

    for simple javascript

    <script>$.getScript(\"https://www.google.com/recaptcha/api.js\", function () {});</script>
    
    0 讨论(0)
  • 2020-12-07 10:48

    For AngularJS users:

    $window.grecaptcha.reset();
    
    0 讨论(0)
  • 2020-12-07 10:51

    For new version of reCaptcha v2 use :

    grecaptcha.reset();
    
    0 讨论(0)
提交回复
热议问题