文章詳情頁
html5 - ajax post請求后如何渲染到頁面上
瀏覽:206日期: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中渲染頁面 或者把從數據庫中查到的數據get到 本人新手 請多包涵
問題解答
回答1:res.json()把數據返回到前端,前端通過DOM操作來更改視圖
標簽:
Html5
上一條:javascript - 關于這組數據如何實現 按字母列表分類展示 不改動數據結構下一條:javascript - 在移動設備上快速滾動屏幕然后點擊使滾動停止,如何盡量避免在點擊時誤觸<a>標簽,跳轉到其他頁?
相關文章:
1. 極光推送 - Android app消息推送 百度 極光 個推 信鴿哪個好一些?2. 什么是前后端分離?用vue angular等js框架就能實現前后分離了嗎?3. ddos - apache日志很多其它網址,什么情況?4. java - Mybatis關聯查詢5. html - css中怎么命名顏色比較好?6. html - chrome 下 transiton translateX(10px) 后字體變化7. java - 為什么第一個線程已經釋放了鎖,第二個線程卻不行?8. javascript - avalon使用:duplex設置select默認option的bug9. android - 百度地圖加載完成監聽10. 這是什么情況???
排行榜
