hi
i am currently using node js to create a simple website.
I am reading files from a mongodb and trying to append the result ( after treatment) to my html.
however, this is not working, althoug i get no errors.
here is the code:
file: clientListHandler
module.exports = {
createClientList: function (clientsList, htmlID) {
console.log(‘received: ’ +clientsList);
clientsList.forEach(function (clientName) {
console.log(‘clientname: ’ + clientName);
$(’#headerDropDownList’).append(’
console.log('i added this: ’ + ’
});
}
};
that file is called inside me app.js file
var setupClientList = require(’./public/javascripts/clientsListHandler’);
//setup the homepage
app.get(’/’, function(req, res){
res.render(‘index’, { title: “People’s Pizza Place” });
Clients.getClients(function(err, clients){
if(err){
throw err;
}
//res.json(clients);
for (i=0; i< clients.length; i++) {
myClientsNames.push(clients[i].toObject().clientName);
}
//the clients names are now available to be handled
setupClientList.createClientList(myClientsNames, ‘headerDropDownList’);
});
});
this is however not adding anything to my page.
any suggestions?
thank you very much