admin管理员组文章数量:1320611
I am trying to implement Google recaptcha in a form. The form issues an HTTP post request to a server where it sends the for data as a JSON object.
I added Google reCAPTCHA just before the form submit button with the following div tag:
<div class="g-recaptcha" data-sitekey="{SITE_KEY}"></div>
Also I added the required JavaScript file in the head tag:
<script src='.js'></script>
Now the submit button issues a request to a JavaScript function as follows: hence I am using Angular JS
$scope.issueVideoUploadRequest = function () {
var requestVideoUploadParameters = {
videoSource: $scope.videoSource,
title: $scope.title,
description: $scope.description,
videoLanguage: $scope.language,
tagsList: $scope.tagsList
};
$http({
method: "POST",
dataType: "json",
data: requestVideoUploadParameters,
url: 'http://localhost:8080/OampSeniorProjectV2/rs/content/requestUploadForm'
}).success(function (response, status, headers) {
$scope.alertMessageVideoRequest = response;
alert(response);
}).error(function (response, status, headers, config) {
$scope.reloadPage();
});
};
The form is submitted to a REST services.
The question is, where to find the g-recaptcha-response parameter so I send it back to the server along with the form JSON object? As I need this response value to perform the server side user verification.
I was following the documentation posted here
I am trying to implement Google recaptcha in a form. The form issues an HTTP post request to a server where it sends the for data as a JSON object.
I added Google reCAPTCHA just before the form submit button with the following div tag:
<div class="g-recaptcha" data-sitekey="{SITE_KEY}"></div>
Also I added the required JavaScript file in the head tag:
<script src='https://www.google./recaptcha/api.js'></script>
Now the submit button issues a request to a JavaScript function as follows: hence I am using Angular JS
$scope.issueVideoUploadRequest = function () {
var requestVideoUploadParameters = {
videoSource: $scope.videoSource,
title: $scope.title,
description: $scope.description,
videoLanguage: $scope.language,
tagsList: $scope.tagsList
};
$http({
method: "POST",
dataType: "json",
data: requestVideoUploadParameters,
url: 'http://localhost:8080/OampSeniorProjectV2/rs/content/requestUploadForm'
}).success(function (response, status, headers) {
$scope.alertMessageVideoRequest = response;
alert(response);
}).error(function (response, status, headers, config) {
$scope.reloadPage();
});
};
The form is submitted to a REST services.
The question is, where to find the g-recaptcha-response parameter so I send it back to the server along with the form JSON object? As I need this response value to perform the server side user verification.
I was following the documentation posted here
Share Improve this question asked May 16, 2015 at 16:32 Ali KhalilAli Khalil 931 gold badge2 silver badges11 bronze badges1 Answer
Reset to default 9grecaptcha.getResponse(widget_id);
This will give you the response of the recaptcha. Use this in your form submit function if you're using Angular.
本文标签:
版权声明:本文标题:javascript - how to get recaptcha client verification parameter g-recaptcha-response after user confirms he is not a robot? - St 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742083681a2419846.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论