-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
42 lines (42 loc) · 1.39 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html lang="en">
<head>
<title>Google recapcha demo - Codeforgeek</title>
<script src="https://www.google.com/recaptcha/api.js?render=SITE"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.form/3.51/jquery.form.min.js"></script>
<script>
grecaptcha.ready(function() {
grecaptcha.execute('SITE', {action: 'homepage'}).then(function(token) {
$('#test_token').val(token)
});
});
</script>
</head>
<body>
<h1>Google reCAPTCHA Demo</h1>
<form id="comment_form" action='/submit' method="post">
<input type="email" placeholder="Type your email" size="40"><br><br>
<textarea name="comment" rows="8" cols="39"></textarea><br><br>
<input type="text" id="test_token" name="test_token">
<input type="submit" name="submit" value="Post comment"><br><br>
</form>
</body>
<script>
// Will put our custom code here.
$(document).ready(function() {
$('#comment_form').submit(function() {
$(this).ajaxSubmit({
error: function(xhr) {
console.log('RESPONSE Error: ' + xhr.status);
},
success: function(response) {
console.log("RESPONSE Success: ", response);
}
});
//Very important line, it disable the page refresh.
return false;
});
});
</script>
</html>