Skip to content

Instantly share code, notes, and snippets.

@DeVoresyah
Created January 4, 2018 15:12
Show Gist options
  • Save DeVoresyah/f9c90b4bc358877bdcb11d7827350542 to your computer and use it in GitHub Desktop.
Save DeVoresyah/f9c90b4bc358877bdcb11d7827350542 to your computer and use it in GitHub Desktop.
Memasang Google ReCaptcha di Halaman Web (Client-side)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Memasang Google ReCaptcha di Halaman Web (Client-side)</title>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>
<div class="g-recaptcha" data-sitekey="SITE-KEY"></div>
<button type="button" onclick="verify()">Verify</button>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
function verify(){
var anti_bot = grecaptcha.getResponse();
if (anti_bot.length == 0) {
alert('ReCaptcha is Successfully Verified')
} else {
alert('ReCaptcha is Not Verified')
}
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment