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. html5 - 求详解h5 video事件监听2. node.js - express无法获取req.params值?3. jupyter-notebook - Mac下启动jupyter notebook后没有Python的选项?4. javascript - vue更改当前节点元素5. android - react-native 在genymotion中一直连不上server6. css3 - 这个效果用 CSS 可以实现吗?border-image7. android - webview 自定义加载进度条8. 如何解决Centos下Docker服务启动无响应,且输入docker命令无响应?9. Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?10. angular.js - angular post的Content-Type被设置,导致不能上传图片,求助!!

网公网安备