私はジオロケーションでいくつかのことをしようとしています。地理位置情報の緯度と経度を 1 つの変数で配列として取得したいと考えています。うまくいきません。コードの最初の行が問題だと思います。そのような値を取得することは可能ですか (リターンあり)?
startingPoint = navigator.geolocation.getCurrentPosition(onGeoSuccess);
function onGeoSuccess(position) {
start['lat'] = position.coords.latitude;
start['lng'] = position.coords.longitude;
return start;
}
より良い解決策はありますか?onGeoSuccess で他のコードを実行したくありません。値を返したいのです。