The api link is working but for some reason when i try to fetch it, it shows 404 on console
console gets: 404 (Not Found)
const outputElement = document.createElement("h1");
document.body.appendChild(outputElement);
const reqOptions = {
method: "GET",
Headers: "Access-Control-Allow-Origin",
};
function getJson(urlApi) {
fetch(urlApi)
.then((response) => {
if (!response.ok) {
throw new Error("Network is not ok");
}
return response.json();
})
.then((data) => {
console.log(data);
outputElement.textContent = JSON.stringify(data.location);
})
.catch((error) => {
console.error(error);
});
}