I send a JSON object from my mangoDB to the html page in this way:
router.get('/index', function (req, res, next) {
GenoverseInstance.find({name: req.query.name}, function (err, instance) {
if (err) {
res.send(err);
throw err;
} else if (instance.length) {
console.log('Object loaded');
// object of the user
console.log(instance[0]);
res.render('index', {object: instance[0]});
}
});
});
I can use it in the html like this:
.containerCustom
.head
h1
| #{object.name}
But I can not use it in my javascript which is included in the html page: script.
alert(object.name);
How is it possible?
Thanks