【发布时间】:2021-12-20 19:59:46
【问题描述】:
如何将“数据”保存到“结果”中?
代码如下:
function GetCoordinates(adres) {
var result = "";
jQuery.getJSON('https://maps.google.com/maps/api/geocode/json?address='+adres+'&sensor=false&key=AIzaSyBxhmTCArabnNgXc6IGM7EEpgohO_mECWs',function(data) {
result = data.results[0].geometry.location["lat"] + ',' + data.results[0].geometry.location["lng"];
});
return result;
}
【问题讨论】:
-
这能回答你的问题吗? jQuery getJSON save result into variable
标签: jquery