定位API代码示例 JavaScript: <script type="text/javascript"> jQuery(document).ready(function ($) { $("#searchtext").keyup(function () { getAutoCompleteValues($("#searchtext").first().attr("value")); }); }); function getAutoCompleteValues(val) { if (val.length < 3) return false; $.ajax({ type: "GET", dataType: "jsonp", jsonp: "callback", jsonpCallback: "callback", url: "http://apidev.accuweather.com/locations/v1/cities/autocomplete?apikey={your key}&q=" + val, cache: false, success: function (data) { // alert(data); $("#results").html(''); $.each(data, function (i, item) { $("#results") .append(+ item.LocalizedName + ", " + item.AdministrativeArea.ID + ", " + item.Country.ID +); }); } }); } </script>