简体   繁体   中英

Parse JSON to HTML with jquery

I need to parse this JSON link

http ://www.mse.mk/FreeMseFeeds/service/FreeMSEFeeds.svc/ticker/JSON/9538ac69-2c99-45ba-bbd4-90931ca0cc7d

to be same like on this page:

http ://www.mse.mk/en/

image: http: //tinypic.com/r/1zlyhwo/8

I've tried like this:

 $.getJSON("http://www.mse.mk/FreeMseFeeds/service/FreeMSEFeeds.svc/ticker/JSON/9538ac69-2c99-45ba-bbd4-90931ca0cc7d",function(data){
   alert(data[0].name);
});

I got this error:

XMLHttpRequest cannot load http:// www.mse.mk/FreeMseFeeds/service/FreeMSEFeeds.svc/ticker/JSON/9538ac69-2c99-45ba-bbd4-90931ca0cc7d. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http: //kristijanz.com' is therefore not allowed access.

Any help ?

Looks like a CORS issue - your application calling www.mse.mk/FreeMseFeeds/service/FreeMSEFeeds.svc/ticker/JSON/9538ac69-2c99-45ba-bbd4-90931ca0cc7d is not running in the same domain.

If you control the service, you can implement CORS to allow other domain origins.

If you do not, you cannot call this service from your domain.

CORS - https://en.wikipedia.org/wiki/Cross-origin_resource_sharing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM