search

Home  >  Q&A  >  body text

node.js - web表单提交后不跳转刷新页面问题?

最近学习web相关的东西,nodejs+express写一个很简单的页面,输入文本框,然后一个查询按钮,点查询之后我可以重定向到其它页面或者本页面,但是不知道怎么把数据传到前端刷新页面,请大神指点下...

黄舟黄舟2872 days ago656

reply all(2)I'll reply

  • 迷茫

    迷茫2017-04-17 11:39:03

    From the requirements, your request should be get, and you can pass the data from the background to the foreground through rendering

    app.get('/u/name',function(req,res){
      res.render('index',{
        name:"xxx",
        title:"xxx"
      });
    });
    

    index is the rendered interface, followed by the data that needs to be passed.

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 11:39:03

    Recommend you to read this article:
    Express Framework

    reply
    0
  • Cancelreply