I'm trying to verify a Recaptcha using jQuery, but I keep getting an error telling me: Access to restricted URI denied" code: "1012
This is what I've tried so far:
var challengeVal = $("#recaptcha_challenge_field").attr("value");
var reponseVal = $("#recaptcha_response_field").attr("value");
var remoteIp = <%= "'" + Request.ServerVariables["REMOTE_HOST"] + "'" %>
var privateKey = 'MY_PRIVATE_KEY';
var requestUrl = "http://api-verify.recaptcha.net/verify?privatekey=" + privateKey + "&remoteip=" + remoteIp + "&challenge=" + challengeVal + "&response=" + reponseVal;
$.ajax({
type: "POST",
url: requestUrl,
dataType: "json",
success: function(data) {
alert('response from recaptcha');
},
error: function() {
alert("An error occured.");
}
});
Anyone tried this, who can point me in the right direction?
Thanks.