Javascript-форум (https://javascript.ru/forum/)
-   Общие вопросы Javascript (https://javascript.ru/forum/misc/)
-   -   XMLHttpRequest. как обойти ошибку? (https://javascript.ru/forum/misc/76456-xmlhttprequest-kak-obojjti-oshibku.html)

TheOwl 13.01.2019 16:09

XMLHttpRequest. как обойти ошибку?
 
Привет! Подскажите пожалуйста, как обойти ошибку.
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://up.htmlacademy.ru/assets/javascript/demo/8-xhr/data.json');
console.log(xhr.readyState);
xhr.responseType = 'json';
xhr.send();


ошибка:
Access to XMLHttpRequest at 'https://up.htmlacademy.ru/assets/javascript/demo/8-xhr/data.json' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Rise 13.01.2019 17:55

Надо сервер подымать, data.json скачать, всё туда положить типа сайт, тогда не будет ошибки.


Часовой пояс GMT +3, время: 14:41.