- var lng,lat;
- var address = "静安寺";
- var url = "http://api.map.baidu.com/geocoder/v2/?address="+address+"&output=json&ak=你的AK值&city=上海";
-
- $.ajax({
- url: url,dataType: "jsonp",jsonp: "callback",success: function (data) {
- lat = data.result.location.lat;
- lng = data.result.location.lng;
- }
- })