I need to call a function passing response rendered to a express-handlebars page. How can I do this?
This my controller and it is rendering result to a handlebars page.
return servico.obterMetricasStatusCode()
.then((resultado) => {
res.status(200).render('erros', {
resultado: resultado
})
});
At handlebars file I have a div with id "chart_div" where I need to put a google chart so I need to call a function that execute this:
var data = google.visualization.arrayToDataTable(resultado);
where the variable called "resultado" is the data to generate the chart but resultado is always undefined when this line is executed.
If I put {{resultado}} inside div the object is printed in screen correctly.
Can I help me?