Rails 3.2 に次の JavaScript コードがあります。
function initialize() { var myLatLng = new google.maps.LatLng(34.553366482, 49.783977595); var mapOptions = { zoom: 12, center: myLatLng, mapTypeId: google.maps.MapTypeId.TERRAIN };
var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
var flightPlanCoordinates = [
new google.maps.LatLng(34.553366482, 49.783977595),
new google.maps.LatLng(34.554122088, 49.783895487),
new google.maps.LatLng(34.554483305, 49.783853715),
new google.maps.LatLng(34.555332372, 49.783720553),
new google.maps.LatLng(34.556189752, 49.783658072),
new google.maps.LatLng(34.556664709, 49.783605137),
new google.maps.LatLng(34.556769403, 49.783602219),
new google.maps.LatLng(34.556787772, 49.783469404),
new google.maps.LatLng(34.556793727, 49.783317126),
new google.maps.LatLng(34.555050604, 49.783479752),
new google.maps.LatLng(34.554290633, 49.783555281),
new google.maps.LatLng(34.55376046, 49.783620191),
new google.maps.LatLng(34.553413552, 49.783659434),
new google.maps.LatLng(34.553275583, 49.783705246),
new google.maps.LatLng(34.553366482, 49.783977595),
];
var flightPath = new google.maps.Polyline({
path: flightPlanCoordinates,
strokeColor: '#FF0000',
strokeOpacity: 1.0,
strokeWeight: 2
});
flightPath.setMap(map);
}
</script>
これは、Google マップでポイントを表示する方法です。データベースからポイントを取得し、javascript に送信したい。どうすればループでそれを行うことができますか?