我想通过从mongodb的到客户对象的数组...如何将对象数组传递给玉模板?
这是对象
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:"#",
},var objeto_img=
{
name:'name of the file',
image:'image.jpg url',
title:'title of the image',
caption:'descripcion of the image',
link:"#",
};]
这是服务器代码
res.render('index/perfil_publicacion_contenido',
{
datos:datosRecibidos
})
datosRecibidos是MongoDB的
和IM试图把一个变量里面玉
input(type='hidden',id='imagenes',value=datos.img)
对象的数组,但是当我试图让物体
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)
}
控制台日志打印未定义
这是为什么?我怎样才能从客户端正确地得到数据库的信息? tnx全部
你的问题还不够清楚。你想达到什么目的? – Max
我想把对象数组隐藏在输入中隐藏“imagenes” – andrescabana86