Answer the question
In order to leave comments, you need to log in
Invisible reCAPTCHA why only works once?
The essence of the problem is that I form reCAPTCHA using ajax in the dialog box, and it works only once, if you close the dialog box and open it again, then the handler will not be called data-callback=" onSubmit "
And now how everything works:
1. In the header
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<div id="g-recaptcha"></div>
var captcha = null;
function createRecaptcha() {
if(captcha === null) {
captcha = grecaptcha.render("g-recaptcha", {
sitekey: "6Ld-xToUAAAAAAda6yqAaKyI3VLa_hFIBE9KBtxB",
callback: "onSubmit",
size: "invisible"});
} else {
grecaptcha.reset(captcha);
}
}
grecaptcha.execute(captcha);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question