this line is not working and no error in console.
position: new google.maps.LatLng( coordsArray[i].location ),
data confirmed by alert(coordsArray[i].location);
location been database field returning LatLng -43.59670,172.38247 as a string.
This line works: position: new google.maps.LatLng( -43.59670,172.38247 ),
What is the same data as above, any ideas what wrong with my code?
var list_location = localStorage.getItem('myHouse');
var obj = JSON.parse(list_location);
var coordsArray = obj;
var marker;
var locX;
var image = 'http://apppics.weebly.com....png';
var map = Appery("googlemap_6").options.mapElement.gmap('get', 'map');
var CreateMarker = function(coordsArray, i){
var marker = new google.maps.Marker({
position: new google.maps.LatLng( coordsArray[i].location ),
//position: new google.maps.LatLng( -43.59670,172.38247 ),
title: coordsArray[i].storeName,
map: Appery("googlemap_6").gmap,
});
for (var i = 0, j = coordsArray.length; i < j-1; i++)
alert(coordsArray[i].location);
CreateMarker(coordsArray, i);
See Question&Answers more detail:os