html5 - 新手提問:為什么form表單的post請(qǐng)求 路由處理不了
問題描述
前臺(tái) ws.html
<form method='post'> <p > <lable for='name'>手機(jī)號(hào)</lable> <input type='text' placeholder='請(qǐng)輸入你的手機(jī)號(hào)' name='pnum'> <lable for='price'>QQ號(hào)</lable> <input type='text' placeholder='請(qǐng)輸入你的qq號(hào)' name='qnum'> <lable for='num'>郵箱</lable> <input type='text' placeholder='請(qǐng)輸入你的郵箱' 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)這個(gè)路由吧,你的 log 信息輸出了嗎?
你的 <form method='post'> 沒有 action,默認(rèn)應(yīng)該 post 到了網(wǎng)站首頁。
相關(guān)文章:
1. docker 下面創(chuàng)建的IMAGE 他們的 ID 一樣?這個(gè)是怎么回事????2. 在應(yīng)用配置文件 app.php 中找不到’route_check_cache’配置項(xiàng)3. html按鍵開關(guān)如何提交我想需要的值到數(shù)據(jù)庫4. mysql取模分表與分表5. gvim - 誰有vim里CSS的Indent文件, 能縮進(jìn)@media里面的6. HTML 5輸入框只能輸入漢字、字母、數(shù)字、標(biāo)點(diǎn)符號(hào)?正則如何寫?7. 跟著課件一模一樣的操作使用tp6,出現(xiàn)了錯(cuò)誤8. PHP類屬性聲明?9. objective-c - ios 怎么實(shí)現(xiàn)微信聯(lián)系列表 最好是swift10. javascript - 請(qǐng)教如何獲取百度貼吧新增的兩個(gè)加密參數(shù)
