0

I want view of contents from another site ... Dont work my code (only jquery, ajax , javascript)

my code:

jQuery.ajax({
    url: 'http://www.varzesh3.com/table/min/Spain?cols=1110000011',
    type: 'GET',
    success: function(res) {
        var data = jQuery(res.responseText).find('.table').text();
        jQuery('#test').html(data);
    }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table id="test"></table>
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
varzesht
  • 25
  • 1
  • 7
  • 1
    Cross-site requests are not allowed by browsers. Maybe, try a JSONP request. – ADreNaLiNe-DJ Jan 06 '17 at 11:09
  • @ADreNaLiNe-DJ How is JSONP going to work when OP is trying to retrieve HTML? Also note that cross-domain requests are allowed by browsers so long as the receiving domain specifically enables them via CORS – Rory McCrossan Jan 06 '17 at 11:18
  • @varzesht if you check the console you'll see this error: `No 'Access-Control-Allow-Origin' header is present on the requested resource.`. This means that you cannot make cross-domain requests to this domain from JS as the response does not contain CORS headers. You will have to make the request from the server side instead. See the duplicate I marked for more information – Rory McCrossan Jan 06 '17 at 11:19
  • Please teach a link or check an example. – varzesht Jan 06 '17 at 11:19

0 Answers0