Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I reload the captcha with AJAX? #71

Open
vgavrilovikj opened this issue Aug 21, 2019 · 2 comments
Open

How can I reload the captcha with AJAX? #71

vgavrilovikj opened this issue Aug 21, 2019 · 2 comments

Comments

@vgavrilovikj
Copy link

I have a form, on submit button click, with AJAX I am calling the php that sends the mail and once the email is sent the form refreshes, how can I generate a new captcha once the form is sent?

@hwvs
Copy link

hwvs commented Jan 22, 2020

var el = document.getElementById("captcha-img");
el.src = el.src.split('?')[0] + "?_=" + Math.random();

replace captcha-img with an id/selector to your captcha image

@visavi
Copy link
Contributor

visavi commented Jan 23, 2020

<img src="/captcha" onclick="this.src='/captcha?'+Math.random()" alt="captcha" style="cursor: pointer;">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants