search

Home  >  Q&A  >  body text

node.js - html接收res.render数据

router.get('/error', function (req, res) {
    res.render('error', { title: 'error' });
});

问题一:html中如何加载上面的title。

问题二:在js中如何获取到render的数据。

html中的代码

1、<title>title</title>
2、<title>{{title}}</title>
3、<title>#{title}</title>

以上三种好像都不对!

PHP中文网PHP中文网2871 days ago998

reply all(3)I'll reply

  • PHPz

    PHPz2017-04-17 15:41:07

    The method of obtaining the background variable value depends on the template you select.
    In html, of course, select <%=%> to get the background variable value.

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 15:41:07

    <%= title %>

    reply
    0
  • 黄舟

    黄舟2017-04-17 15:41:07

    . . .

    What template are you using?

    reply
    0
  • Cancelreply