There is an error:

XMLHttpRequest cannot load http://steamcommunity.com/groups/valve . No 'Access-Control-Allow-Origin' header is present. Origin ' http://site-name.com ' is not allowed access.

I'm trying to get information from the Steam website and display it on my jQuery :

 $('#kek').load('http://steamcommunity.com/groups/valve .membergrid'); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="kek"></div> 

How to get around this error?
I heard about JSONP , but without a clue how to apply it.

Reported as a duplicate by members VladD , user207618, rjhdby , Grundy , Pavel Mayorov on Oct 13 '16 at 6:41 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • I will translate: error: the site did not allow other sites to load from it via ajax. Use php or iframe. - Dimava
  • In the script, you will not get any info from it. - Dimava
  • @Dimava, Wrong. Crawls a lot. - user207618
  • Well, the simplest way is to mirror via php (in the sense of the server) - the header does not work on the server, only on browsers. But in the browser clean js should not work. - Dimava

1 answer 1

It is better to use such a construction, instead of what you use. And read about crossdomain request.

 var XHR = ("onload" in new XMLHttpRequest()) ? XMLHttpRequest : XDomainRequest; var xhr = new XHR(); xhr.open('GET', 'http://steamcommunity.com/groups/valve.membergrid', true); // (2) загрузка ответа и вставление кнопки под script xhr.onload = function() { this.response; } //@todo если что-то пошло не так, нужно сделать ajax на запись error xhr.onerror = function() { //alert( 'Ошибка ' + this.status ); }; //отправка запроса xhr.send(); 
  • And how this design will help him? - Pavel Mayorov