javascript – JQuery将json解释为脚本?

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

这是我得到的错误:

“Resource interpreted as Script but transferred with MIME type application/json.” (“Resource” is referring to is the json response from google’s servers.)

这是我的代码:

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

<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>
相关文章
相关标签/搜索