您的问题是,您没有将回调连接到返回值。由于
geopre()函数本身已经是异步的,因此
return对它没有任何影响。相反,您必须将您在此处返回的值直接传递给回调函数。像这样:
function getLocationData(position, callback) { geoprer = new google.maps.Geoprer(); var location = 'Billings,MT'; if( geoprer ) { geoprer.geopre({ 'address': location }, function (results, status) { if( status == google.maps.GeoprerStatus.OK ) { callback(results[0]); } }); }}


