I was building something with google maps and I wrote this piece of code to fill the infowindows:
mouseover: function(marker, event, context){
var numManc = context.data.num_manc;
var elencoManc = '';
for(i=1;i<=numManc;i++)
{
var mymanc = i;
elencoManc = elencoManc + context.data.mancinita.mymanc.mancinita;
}
etc....
I alsway get this error TypeError: context.data.mancinita.mymanc is undefined.
Actually what I need is that the var "elencoManc" concatenate itself N times, where N equals the var "numManc".
So in the "for" loop I should get something like
elencoManc = elencoManc + context.data.mancinita.1.mancinita;
elencoManc = elencoManc + context.data.mancinita.2.mancinita;
elencoManc = elencoManc + context.data.mancinita.3.mancinita;
elencoManc = elencoManc + context.data.mancinita.N.mancinita;
It seems that I cannot make that concat dynamic.
This is one record stored in the array:
{
lat: 35.110901,
lng: 12.876027,
options: {
icon: "icon_2.png",
},
data: {
nome: "Name of the sotre",
indirizzo: "Address of the sotre",
city: "Rome",
linkStore: "http://www.storelink.com",
immagine_copertina: "asset/imageStore.png",
city: "Rome",
num_tipi: 1,
num_manc: 2,
tipi_1: {
icona_tipo: "asset/ico/ico2.png",
tipo: "negozio_bio"
},
mancinita: {
1: {
icona: "iconManc2.png",
idmanc: 2,
mancinita: "organic"
},
2: {
icona: "iconManc5.png",
idmanc: 5,
mancinita: "lowFat"
},
},
distanza: "0.000"
}
}
Any suggestions? Thanks
SyntaxError: missing name after . operator