如何获取响应体的元素状态?
- 如何获取响应体的元素状态? 推荐度:
- 相关推荐
如何获取响应体的元素状态?
有一个用expressJS连接的表单,当我按下提交按钮时,表单将数据(图片方向)输入到一个路径上,我用router.post()函数得到。 当我按下提交按钮时,表单将输入的数据(图像方向)发布到一个路径上,我用router.post()函数获取。
当我发送错误的图像方向时,图像状态的响应是404。
问题是我如何才能得到这个状态。我想把它放在一个变量中。
表格代码。
extends ../layouts/main-layout.pug
block content
form(action='/admin/add-product', method='POST')
.row
.input-field.col.s6
input#name.validate(name ='name',type='text', placeholder='Please Enter A Product Name')
.input-field.col.s6
input#name.validate(name='image',type='text', placeholder='Please Enter A Product Image')
.input-field.col.s6
input#name.validate(name='state',type='text', placeholder='Please Enter A Product State')
.input-field.col.s6
input#name.validate(name='price',type='text', placeholder='Please Enter A Product Price')
.input-field.col.s12
button.btn.waves-effect.waves-light(type='submit', name='submit')| Submit
router.get code :
module.exports.postAddProduct = (req, res) => {
console.log(req.body.name);
res.redirect('/');
};
回答如下:Console的响应和访问它像 console.log(res.status);
最新文章
- Annotation定义
- WinRAR 3.933.92 的注册码(已经测试)
- 我也来说非诚勿扰
- 简略写dump文件
- Window Server 2008虚拟机安装
- 程序与软件的易用性
- 用最速下降法求最优解
- java文件下载错误提示
- IIS的安全配置
- CSS之text
- .MMAP是什么格式?
- mmap。
- anchor的用法
- SpringSecurity原理:探究SpringSecurity运作流程
- java鬼混笔记:springboot 5、springboot的Scheduled定时器:fixedDelay和fixedRate区别
- 数据和安全②HTTPS单向和双向认证
- 1637
- IDEA乱码问题(jdk18)
- SQL Server DBCC
- Qt QSqlQueryModel详解