M
M
mohindersuresh2019-01-11 15:31:43
JavaScript
mohindersuresh, 2019-01-11 15:31:43

Can't get json object. How to be?

I use a local server. I make a test request to the desired site:

$.get("https://www.********.com/api/product/sale.json?id=553453836&quick=&gem_id=0&page=1&flag=&delivery=&sort=&b1=&style=");


The browser console outputs this:

Access to XMLHttpRequest at ' https://www.********.com/api/product/sale.json?id=... ' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Cross-Origin Read Blocking (CORB) blocked cross-origin response https://www.********.com/api/product/sale.json?id=... with MIME type application/json. See https://www.chromestatus.com/feature/5629709824032768 for more details.

In general, from the requested json I want to pull out the first name and price that came across {"name":"some name","price":110.5}. Tell me, plz, how to do it? Maybe you can also recommend a book, I want to write a parser that will display these values ​​for hundreds of other items in a table .. The third week has gone, but I still can’t pull out the price tag ..)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
XNicON, 2019-01-11
@XNicON

On the server, the Access-Control-Allow-Origin attribute is not registered in the request header,
so don’t pull out js / read more about cross-origin and Access-Control-Allow-Origin

R
Rastishka, 2019-01-11
@Rastishka

I in that case pumped through the server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question