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页面在手机浏览器里和微信全屏显示2. css - calc()设置宽度等于自身的高度?3. node.js - nodejs开发中常用的连接mysql的库4. MYSQL代码执行错误:FUNCTION any_value does not exist5. 微信小程序如何加载h5页面6. paramiko - Python tempfile生成的文件能不能拷贝到远程服务器?7. mysql - oracle物化视图和临时表的区别是什么?8. 网页爬虫 - python+requests 网页重定向求解9. javascript - 关于json中获取多个key-value对中多层嵌套key的name10. WebDriverException:消息:服务/ content / chromedriver意外退出状态代码为:-6(使用ChromeDriverGoogle Colab和Selenium)