samedi 25 avril 2015

ejs code to display a string variable sent by PostController.js in Sails


Attempting to display a string variable in postview.ejs sent by PostController.js in Sails

val is the string variable

[ ejs html javascript Sails express node.js ]

PostController.js

module.exports = {

post : function (req, res) {
     var val = req.param('valeur');
     console.log('val =', valeur); // controller test : no problem so far
     res.render('postview')

postview.ejs (?)

  <html>
  <h1>Post view</h1>
  <body>

// until now everything is running smoothly  

  <script type=«text/javascript»>
    document.write ('your value :' + val)
  </script>

  </body>
  </html>

ejs code not working : is javascript relevant here ?

What is the correct code in Sails to display val string in the return view ?


Aucun commentaire:

Enregistrer un commentaire