How to get a variable sent from the server

0

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.

    
asked by José Llamas 25.01.2018 в 18:44
source

1 answer

0

In the teplate PUG access the variable by interpolation, #{nombreDeLaVariable} . For example:

html
   body
       h1 Hello World!
          p This is the message: #{message}
    
answered by 25.01.2018 в 20:04