JQuery won't get json?

前端 未结 5 1546
一向
一向 2020-12-03 12:07

So I\'m trying to complete the simple task of getting json data from google, but this little bit of jquery code won\'t run. Will you please help me figure out why?



        
5条回答
  •  醉梦人生
    2020-12-03 12:40

    Yup, this is absolutely a Same Origin Policy bug.

    It seems that the latest version of the Google Maps API (v3) does not support jsonp. As a result, if you want to geocode, you're going to need to use the maps api:

    
    
    
    
    

    Other alternatives:

    • Use a 'proxy' service, as ctcherry pointed out, to fetch the data for you.
    • Use the old V2 API with JSONP, but you'll need a Maps API key.

提交回复
热议问题