您的位置:首页技术文章
文章详情页

html5 - ajax post请求后如何渲染到页面上

【字号: 日期:2022-12-05 09:31:27浏览:49作者:猪猪

问题描述

router.post(’/goods/tejia’,function(req,res,next){ var gid = req.body.gid; console.log(gid); User.find({gid :gid }).then(function(goodsInfo){console.log(goodsInfo);// res.render(’main/goods’,{// goodsInfo : goodsInfo// }) })})router.get(’/’,function(req,res,next){ console.log(req.goodsInfo); res.render(’main/goods’,{ goodsInfo : req.goodsInfo })})

问题是如何在post中渲染页面 或者把从数据库中查到的数据get到 本人新手 请多包涵

问题解答

回答1:

res.json()把数据返回到前端,前端通过DOM操作来更改视图

标签: Html5
相关文章: