function getPos(position) {
var latitude = 11.11;
var longitude = 11.11;
$.ajax({
url: ‘http://api.map.baidu.com/geocoder/v2/?ak=A8cc7c770c518c3fc4714a4ca452aadc&callback=renderReverse&location=‘ + latitude + ‘,‘ + longitude + ‘&output=json&pois=0‘,
cache: true,
dataType: ‘jsonp‘,
success: function(result) {
renderReverse(result);
}
});
}
function getPosError() {
dialog.alert(‘获取坐标失败,请手动选择省份和城市‘);
clearStatus();
}
function renderReverse(data) {
if (data.status === 0) {
var addrCpt = data.result.addressComponent;
var province = addrCpt.province;
var city = addrCpt.city;
}
时间: 2025-01-08 21:12:47