I am using Google reCAPTCHA on my site. If the captcha is success I want to redirect to another website.
The code I used is:
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script type="text/javascript">
if (grecaptcha.getResponse() == "success") {
function Redirect() {
window.location = "example.com";
}
document.write("You will be
redirected to a new page in 5 seconds "); setTimeout('Redirect()',
1000);
}
} else {
alert("You can't proceed!");
</script>
<body>
<div data-type="image" class="g-recaptcha" data-sitekey="public site key"></div>
</body>
But it's not working.
Edited
I just don't understand JavaScript much . That's why I was asking and still don't understand it . What it means and what does I have to do with it. https://www.google.com/recaptcha/api/siteverify Can you give me an example of whole code