How to access the variable passed through res.renderer?

I'm passing a variable to my template renderer in ExpressJs like so:


app.get('/simple_view/', function(req, res, next){
  title='A TITLE';
  res.render('simple', {
          title: title

I would like to access the title variable in a JS script on my template page, but I'm getting Uncaught ReferenceError: title is not defined error.



How can I solve this?

Read more here:

Content Attribution

This content was originally published by IMAGINE PRODUCTIONS at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: