JQuery将json解释为脚本?

And*_*rew 4 javascript jquery json

如果你们都能帮助我,我真的很感激.

这是我得到的错误:

"资源被解释为脚本,但使用MIME类型application/json进行传输." ("资源"指的是来自谷歌服务器的json响应.)

这是我的代码:

  $(document).ready(function(){
    $.getJSON("http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false&callback=?", function(jsondata) {
    });
  });
Run Code Online (Sandbox Code Playgroud)

Pan*_*cus 5

试试这个:

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>

<script>
    $(document).ready(function(){
        var loc = "1600 Amphitheatre Parkway, Mountain View, CA";
        var geocoder = new google.maps.Geocoder();
        geocoder.geocode( {'address': loc },
            function(data, status) { console.log(data); });
    });
</script>
Run Code Online (Sandbox Code Playgroud)