Забрать возвращение 404 [закрыто]Javascript

Форум по Javascript
Anonymous
Забрать возвращение 404 [закрыто]

Сообщение Anonymous »

Ссылка API работает, но по какой -то причине, когда я пытаюсь получить ее, она показывает 404 на консоли < /p>
Консоль получает: 404 (не найдено) < /p>
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);
});
}


Подробнее здесь: https://stackoverflow.com/questions/794 ... urning-404

Вернуться в «Javascript»