I'm having a little bit problems, I'm trying to send an object to use on my Javascript client side, whenever I render the view. I am sending it this way (Im using Handlebars)
> locations=[ {
> local:"my_local",
> desc:"myDesc"
> }];
res.render('myView', { locaciones:locaciones });
// Then in my view Inside a script tag i try to get that var and print it
<script>
var myObj='{{locations}}';
console.log(locations);
</script>
the result is this :
[object]
and I can't use any property of it because it's undefined
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…