我能够从一个玉页发送数据到另一个,但我不知道如何在app.js的其他页面中使用它?(I am able to send a data from one jade page to other but I

编程入门 行业动态 更新时间:2024-10-12 14:23:10
我能够从一个玉页发送数据到另一个,但我不知道如何在app.js的其他页面中使用它?(I am able to send a data from one jade page to other but I am not knowing how to use that in other page in app.js?)

我将变量'id'从索引页面发送到info / studs页面,它正在执行该部分,但我无法在app.js中使用该变量

extends layout block content .container .col-md-4 h2 Name a(href='../info/studs?id=#{user.id}') #{user.name} and app.js file containing app.get('/info/studs',function(req, res){ //Here I want to use variable 'id'

});

I am sending the variable 'id' from index page to info/studs page, and it is doing that part,but I am not able to use that variable in app.js

extends layout block content .container .col-md-4 h2 Name a(href='../info/studs?id=#{user.id}') #{user.name} and app.js file containing app.get('/info/studs',function(req, res){ //Here I want to use variable 'id'

});

最满意答案

查看req.query对象以获取更多信息。

要具体回答这个问题:

app.get('/info/studs',function(req, res){ //Here I want to use variable 'id' var id = req.query.id //You can now use the 'id' variable as you want. })

Take a look into the req.query object for more information.

To specifically answer the question:

app.get('/info/studs',function(req, res){ //Here I want to use variable 'id' var id = req.query.id //You can now use the 'id' variable as you want. })

更多推荐

本文发布于:2023-08-04 05:56:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1410099.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:但我   页面   数据   如何在   使用它

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!