从 api (x-api-key) 检索用户数据
retrieving user data from api (x-api-key)
我是初学者 javascript 程序员,在这里尝试使用 fetch 检索用户信息,问题是,有没有简单的方法来搜索特定的人,例如:Laurel Gates USERID:987654321
英语不是我的母语,所以对错误感到抱歉。
这是我的代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Retrieve</title>
<meta name="viewport" content="width=device-width">
<style>
</style>
</head>
<body>
<script>
fetch("https://*******.****-.com/",{
method:"GET",
headers:{
"Content-type": "application/json",
"X-API-Key": "o************************G"
}
})
.then( function(vastaus) {
if(vastaus.ok){
return vastaus.json();
}
})
.then( function(tiedot) {
console.log(tiedot);
})
.catch( function(virhe) {
console.log('ERROR: ', virhe.message);
});
</script>
</body>
</html>
通过聊天问题讨论后,内容响应和响应没有 console.log
调用的某些 属性
我是初学者 javascript 程序员,在这里尝试使用 fetch 检索用户信息,问题是,有没有简单的方法来搜索特定的人,例如:Laurel Gates USERID:987654321 英语不是我的母语,所以对错误感到抱歉。 这是我的代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Retrieve</title>
<meta name="viewport" content="width=device-width">
<style>
</style>
</head>
<body>
<script>
fetch("https://*******.****-.com/",{
method:"GET",
headers:{
"Content-type": "application/json",
"X-API-Key": "o************************G"
}
})
.then( function(vastaus) {
if(vastaus.ok){
return vastaus.json();
}
})
.then( function(tiedot) {
console.log(tiedot);
})
.catch( function(virhe) {
console.log('ERROR: ', virhe.message);
});
</script>
</body>
</html>
通过聊天问题讨论后,内容响应和响应没有 console.log
调用的某些 属性