html5 - 新手提問:為什么form表單的post請求 路由處理不了
問題描述
前臺 ws.html
<form method='post'> <p > <lable for='name'>手機(jī)號</lable> <input type='text' placeholder='請輸入你的手機(jī)號' 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:根本就沒有進(jìn)這個路由吧,你的 log 信息輸出了嗎?
你的 <form method='post'> 沒有 action,默認(rèn)應(yīng)該 post 到了網(wǎng)站首頁。
相關(guān)文章:
1. java - 安卓電視盒子取得了root權(quán)限但是不能安裝第三方應(yīng)用,請問該怎么辦?2. 在MySQL中新增字段時,報錯??3. 老哥們求助啊4. python - 模擬滑動驗證碼,有源碼,求解5. javascript - js 寫一個正則 提取文本中的數(shù)據(jù)6. css3 - 請問一下在移動端CSS布局布局中通常需要用到哪些元素,屬性?7. npm鏡像站全新上線8. javascript - vue-router怎么不能實現(xiàn)跳轉(zhuǎn)呢9. javascript - [WDS] Disconnected! 一直重復(fù)出現(xiàn)。10. html5 - angularjs中外部模版加載無法使用
