Пытаюсь поставить re-captcha v2, сама капча отображается нормально, но при попытке нажать на нее вылезает:
Access to XMLHttpRequest at 'https://www.google.com/recaptcha/api/siteverify' from origin 'http://xn--e1aasmbckk9a.xn--p1ai' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
var verifyCallback = function(response) {
$.ajax({
url: 'https://www.google.com/recaptcha/api/siteverify',
method: 'post',
dataType: 'json',
data: {
secret: 'secretkey',
response: response
},
success: function(data) {
alert(data);
}
});
};
var onloadCallback = function() {
recaptcha = grecaptcha.render('g-recaptcha', {
'sitekey' : 'sitekey',
'callback' : verifyCallback,
});
};