My code starts like this
res.render ("index", {message: "Hello"});
The question is how to get that variable message in javascript code.
Use nodejs as a server. To serve the template use pug. successor of jade.
My code starts like this
res.render ("index", {message: "Hello"});
The question is how to get that variable message in javascript code.
Use nodejs as a server. To serve the template use pug. successor of jade.
In the teplate PUG access the variable by interpolation, #{nombreDeLaVariable}
. For example:
html
body
h1 Hello World!
p This is the message: #{message}