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

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -