请求的类型(本文的请求以axios为例). 具体的还是要看后台的处理与配合
1.post:
axios.post("/user",{
data:data
},{
contentType:“application/json/multipart/form-data”,
withCredentials:true,
}).then(res => {
console.log(res)
}).catch(err => {
console.log(err);
});
2.get:
axios.get("/user?data=data",{
contentType:“application/json/multipart/form-data”,
withCredentials:true,
}).then(res => {
console.log(res)
}).catch(err => {
console.log(err);
});
3.put:
axios.post("/user",{
data:data
},{
contentType:“application/json/multipart/form-data”,
withCredentials:true,
}).then(res => {
console.log(res)
}).catch(err => {
console.log(err);
});
4.delete
axios.post("/user/data",{
contentType:“application/json/multipart/form-data”,
withCredentials:true,
}).then(res => {
console.log(res)
}).catch(err => {
console.log(err);
});