i want to pass an array of objects from mongodb to the client...
this is the object
var objeto_img=
{
name:'name of the file',
image:'image.jpg url',
title:'title of the image',
caption:'descripcion of the image',
link:"#",
};
in some profiles the are many images so the is an array of objects like this
[var objeto_img=
{
name:'name of the file',
image:'image.jpg url',
title:'title of the image',
caption:'descripcion of the image',
link:"#",
},var objeto_img=
{
name:'name of the file',
image:'image.jpg url',
title:'title of the image',
caption:'descripcion of the image',
link:"#",
},var objeto_img=
{
name:'name of the file',
image:'image.jpg url',
title:'title of the image',
caption:'descripcion of the image',
link:"#",
};]
this is the server code
res.render('index/perfil_publicacion_contenido',
{
datos:datosRecibidos
})
datosRecibidos is an array of objects from mongodb
and im trying to put in a variable inside jade
input(type='hidden',id='imagenes',value=datos.img)
but when i try to get the objects
var fotos=$('#imagenes1').val();
for(foto in fotos)
{
console.log(fotos[foto].image)
console.log(fotos[foto].name)
console.log(fotos[foto].caption)
console.log(fotos[foto].title)
}
the console log print undefined
why is that??? how can i get the information from db correctly in the client??? tnx all