您的位置:首頁技術文章
文章詳情頁

html5 - 新手提問:為什么form表單的post請求 路由處理不了

瀏覽:157日期:2022-11-21 14:27:44

問題描述

前臺 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 : '恭喜你完善成功', })})

html5 - 新手提問:為什么form表單的post請求 路由處理不了

問題解答

回答1:

根本就沒有進這個路由吧,你的 log 信息輸出了嗎?

你的 <form method='post'> 沒有 action,默認應該 post 到了網站首頁。

標簽: Html5
相關文章:
国产综合久久一区二区三区