我正试图从
获取答案recapcha / api / siteverify
我将网址生成为:
www.google.com/recaptcha/api/siteverify?secret=secret_key&response=g-recaptcha-令牌
,当我只是通过浏览器访问该URL时,它会显示success:true
的json以及正确的时间戳和主机名。
所以我试图获取这些结果:
fetch(url).then(
function(response) {
window.alert(response.json())
if (!response.success){
window.console.log('Looks like there was a problem. Status Code: ' +
response.error);
return;
}
// Examine the text in the response
window.alert("verified!");
}
)
但是结果是
TypeError:尝试获取资源时出现NetworkError。
我在做什么错了?