As a beginner JavaScript programmer, I'm attempting to fetch user information. Is there a simple way to search for a specific person like Laurel Gates with the USERID: 987654321? English is not my native language, so I apologize for any mistakes. Here is the code I'm using:
<!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(response) {
if(response.ok){
return response.json();
}
})
.then( function(data) {
console.log(data);
})
.catch( function(error) {
console.log('ERROR: ', error.message);
});
</script>
</body>
</html>