Google Map: Dynamic Array generation javascript
Can any one please advice me, that, i need to generate an array dynamically for google map...
I have a lat
and long
values from my Database. here i would like to built an array with those values like...the below one.
var store_locations = new Array();
store_locations = [
new google.maps.LatLng(39.112456,-84.574779),
new google.maps.LatLng(39.314153,-84.261379),
new google.maps.LatLng(39.197099,-84.667579),
new google.maps.LatLng(39.16836,-84.479381)
];
The inner par开发者_开发问答t of the square bracket should be dynamic. please advice.
you can use array.push
in your cycle
store_locations.push(new google.maps.LatLng(39.112456,-84.574779));
You can easily do this by pushing new elements to the array:
var store_locations = new Array();
store_locations.push(new google.maps.LatLng(39.112456,-84.574779));
精彩评论