1.问题描述:
axios的GET请求本地可以执行,服务器无法报错400;换成POST请求参数接收不到?
注:后台是struts2,请求action通过get方法获取对应参数值
解决方案如下:
axios({/com/**/**!saveEmployeeInfo.shtml',
method: 'post',
data: $.param({
employeeInfo: JSON.stringify(info)
}),
headers:{
'Content-type': 'application/x-www-form-urlencoded'
},
}).then((response) => {
...
}).catch(err => {
...
});
注:info是JSON对象