I have an express.js app using with Jade. I'm trying to read information from the server on the client however I keep getting errors.
router.js
res.render('index', { title: 'cooltitle'})
index.jade
script(src='/javascripts/index.js')
h1=title
script(type='text/javascript').
var data = !{title}
console.log(data)
h1 correctly shows the title: 'cooltitle' in the browser. But trying to read the data in the javascript results in the following errror Uncaught ReferenceError: cooltitle is not defined at (index):1:298
Also is there a way to get the title object from the index.js? i get the following error: Uncaught ReferenceError: title is not defined at main.js:2:13
index.js
console.log(title)