axios發送post form請求
只需修改url和data即可
axios({
url: '/user',
method: 'post',
data: {
firstName: 'Fred',
lastName: 'Flintstone'
},
transformRequest: [function (data) {
let ret = ''
for (let it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
}
return ret
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
我的github
我的博客
我的筆記
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/123531.html
標籤:JavaScript
