getting json from external source in javascript

前端 未结 3 1568
日久生厌
日久生厌 2021-01-27 03:43

Json issues with javascript and jquery. Trying to load some JSON using javascript.

I have it working using:

See it here: http://jsfiddle.net/5pjha/789/



        
3条回答
  •  轮回少年
    2021-01-27 04:30

    The google's api set the Access-Control-Allow-Origin header to *, so you could access it by cross domain.

    While other urls you provided do not, so you will got an error like below:

    XMLHttpRequest cannot load https://api.mintpal.com/v1/market/summary/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://fiddle.jshell.net' is therefore not allowed access.

提交回复
热议问题