javascript - Reload reCaptcha after ajaxComplete - Stack Overflow

My reCaptcha is not reloading when ajaxComplete event plete.I have a console error: "No reCAPTCHA

My reCaptcha is not reloading when ajaxComplete event plete.

I have a console error: "No reCAPTCHA clients exist." So why my reCaptcha client disappeared after ajaxComplete?

Here is my sample code:

 $(document).ajaxComplete(function (event, request, settings) {
         grecaptcha.reset(); });

My reCaptcha is not reloading when ajaxComplete event plete.

I have a console error: "No reCAPTCHA clients exist." So why my reCaptcha client disappeared after ajaxComplete?

Here is my sample code:

 $(document).ajaxComplete(function (event, request, settings) {
         grecaptcha.reset(); });
Share Improve this question edited Mar 10, 2019 at 22:35 Cody Gray 245k53 gold badges504 silver badges584 bronze badges asked Apr 19, 2018 at 18:33 user4095424user4095424
Add a ment  | 

2 Answers 2

Reset to default 2

Adding the grecaptcha.render('recaptchaId'); solved the problem.

So, the updated code is:

 $(document).ajaxComplete(function (event, request, settings) {
         grecaptcha.render('recaptchaWıdgetId'); });

The problem is clearly stated in the exception. You need to render reCaptcha on the page with grecaptcha.render:

var domId = 'recaptchaId';
grecaptcha.render(domId, {"sitekey": "YOUR_CAPTCHA_ID", size: 'invisible'});

In my case error came from minified code:

if (y[6](57).contains(window.___grecaptcha_cfg.clients[P].Ci)){
  Y=P;
  break a
}
throw Error("No reCAPTCHA clients exist.");

and window.___grecaptcha_cfg.clients was empty till I fixed the order: render is called before execute.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742299593a4417787.html

相关推荐

  • javascript - Reload reCaptcha after ajaxComplete - Stack Overflow

    My reCaptcha is not reloading when ajaxComplete event plete.I have a console error: "No reCAPTCHA

    16小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信