How do I get the client's recaptcha g-recaptcha-response validation option after the user confirms that they are not a robot?
I am trying to implement google recaptcha on a form. The form issues an HTTP request to the server where it submits the 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 to the header:
<script src='https://www.google.com/recaptcha/api.js'></script>
Now the submit button issues a JavaScript function request like this: 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 REST services.
The question is, where can I find the g-recaptcha-response parameter to send it back to the server along with the JSON object form? As I need this response value to perform server side validation.
I followed the documentation posted here
+3
source to share