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 到了網(wǎng)站首頁。
相關(guān)文章:
1. python - 如何正則字符串中的所有漢字2. mysql - 千萬級數(shù)據(jù)的表,添加unique約束,insert會不會很慢?3. python - oslo_config4. mysql - 分庫分表、分區(qū)、讀寫分離 這些都是用在什么場景下 ,會帶來哪些效率或者其他方面的好處5. mysql - 如何減少使用或者不用LEFT JOIN查詢?6. mysql - eclispe無法打開數(shù)據(jù)庫連接7. mysql 5個left關(guān)鍵 然后再用搜索條件 幾千條數(shù)據(jù)就會卡,如何解決呢8. mysql - jdbc的問題9. 圖片鏈接的地址怎么獲得的10. 視頻文件不能播放,怎么辦?
