html5 - 新手提問:為什么form表單的post請求 路由處理不了
問題描述
前臺 ws.html
<form method='post'> <p > <lable for='name'>手機號</lable> <input type='text' placeholder='請輸入你的手機號' name='pnum'> <lable for='price'>QQ號</lable> <input type='text' placeholder='請輸入你的qq號' name='qnum'> <lable for='num'>郵箱</lable> <input type='text' placeholder='請輸入你的郵箱' name='email'> </p> <button type='submit' class='btn btn-default'>提交</button></form>
路由 ws.js
router.post(’/ws’,function(req,res,next){ console.log(req,body); res.render(’suc’,{ message : '恭喜你完善成功', })})
問題解答
回答1:根本就沒有進這個路由吧,你的 log 信息輸出了嗎?
你的 <form method='post'> 沒有 action,默認應該 post 到了網站首頁。
相關文章:
1. sql語句 - mysql中關聯表查詢問題2. css - chrome下a標簽嵌套img 顯示會多個小箭頭?3. javascript - 如何將一個div始終固定在某個位置;無論屏幕和分辨率怎么變化;div位置始終不變4. html - vue項目中用到了elementUI問題5. javascript - iframe 為什么加載網頁的時候滾動條這樣顯示?6. python - django models 為生成的html元素添加樣式。7. javascript - vscode alt+shift+f 格式化js代碼,通不過eslint的代碼風格檢查怎么辦。。。8. javascript - 有什么比較好的網頁版shell前端組件?9. mysql updtae追加數據sql語句10. javascript - 原生canvas中如何獲取到觸摸事件的canvas內坐標?
