jquery - getJSON using an external url -


i attempting read external json file script:

$.getjson('http://www.earthquake.usgs.gov/earthquakes/feed/geojson/1.0/hour',function( json ) { //$.getjson('hour',function( json ) {     $.each( json.features, function( i, item ){         alert(item.properties.mag);     }); }); 

when use external url, script doesn't work, however, when use local hour file (that copied , pasted external url) script works fine. why?

i'm going "that guy" posts answer type of question. you can't due same origin policy (google it!)

actually, if need this, can setup proxy using php , use proxy obtain necessary data.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

php - HTTP_REFERER woes: How can I allow access to a specific page, only when a visitor has visited another specific page beforehand? -