国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術(shù)文章
文章詳情頁

html5 - ajax post請求后如何渲染到頁面上

瀏覽:190日期:2022-12-05 09:31:27

問題描述

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中渲染頁面 或者把從數(shù)據(jù)庫中查到的數(shù)據(jù)get到 本人新手 請多包涵

問題解答

回答1:

res.json()把數(shù)據(jù)返回到前端,前端通過DOM操作來更改視圖

標(biāo)簽: Html5
相關(guān)文章:
主站蜘蛛池模板: 万载县| 长顺县| 南城县| 清苑县| 太和县| 衡阳县| 南昌市| 九台市| 静宁县| 民权县| 靖远县| 德保县| 武定县| 长春市| 昌都县| 临夏市| 湛江市| 顺昌县| 宽城| 麦盖提县| 兴义市| 高邮市| 昌都县| 湄潭县| 茂名市| 桂东县| 白河县| 新绛县| 鹿邑县| 衡东县| 石门县| 石景山区| 松原市| 政和县| 蚌埠市| 左云县| 福安市| 冷水江市| 永新县| 达尔| 南昌县|