Форум по Javascript
-
Anonymous
Получить правила пропуска?
Сообщение
Anonymous »
Код: Выделить всё
let apiQuotes = [];
// Get quote from Api
async function getQuotes(){
const apiUrl = 'http://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=json';
try {
const response = await fetch(apiUrl);
apiQuotes = await response.json;
console.log(apiQuotes);
} catch (error) {
console.log('whoo! there is an', error);
}
}
// on load
getQuotes();
при получении данных по указанному выше URL-адресу постоянно выдается сообщение об ошибке ниже
Подробнее здесь:
https://stackoverflow.com/questions/798 ... ors-policy
1766424918
Anonymous
[code]let apiQuotes = [];
// Get quote from Api
async function getQuotes(){
const apiUrl = 'http://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=json';
try {
const response = await fetch(apiUrl);
apiQuotes = await response.json;
console.log(apiQuotes);
} catch (error) {
console.log('whoo! there is an', error);
}
}
// on load
getQuotes();
[/code]
при получении данных по указанному выше URL-адресу постоянно выдается сообщение об ошибке ниже
Подробнее здесь: [url]https://stackoverflow.com/questions/79853092/getting-pass-cors-policy[/url]