0

I try to fetch information from a public website area. Let's just say I want the Product name and a Price of it only. When I try to get the information from the site it giving me an error:

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://demo.com' is therefore not allowed access.

The script I use is:

$(document).ready(function() {
    $.get("http://www.ebay.com", function(data) {
        console.log(data)
    });
});
Anik Islam Abhi
  • 25,137
  • 8
  • 58
  • 80
  • 2
    Please help me understand the problem and give some examples from ebay or another sites. – Alexey Gouzanov Jan 06 '16 at 02:00
  • 4
    The error message tells you exactly what the problem is: you are not authorised to get that page from the clientside. Read about [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing). If you want to access eBay's prices from the clientside, the correct way is to use their [API](https://go.developer.ebay.com/what-ebay-api), not to scrape the human-facing pages. – Amadan Jan 06 '16 at 02:03

0 Answers0