以json形式提交
axios.
post
(url,).
then
( res =>).
catch
( res =>
)
如果後端人員比較老派,沒法接受json格式,那就給他提交formdata
var fd =
newformdata()
fd.(
'key'
, value)
let config =
}axios.
post
(url, fd, config).
then
( res =>).
catch
( res =>
)
或者使用cdn方式引入
>
>
src=
"">
script
>
src=
"">
script
>
head
>
>
>
let url =
""let data =
// 注意qs是大寫,和npm引入方式不一樣
axios.
post
(url, qs.
stringify
(data)).
then
(res=>).
catch
(err=>
)script
>
body
>
html
>
參考axios配置後,post提交formdata
POST提交資料
post提交的引數,格式如下 引數1名字 引數1資料 引數2名字 引數2資料 引數3名字 引數3資料 nslog post post 將nssrring格式的引數轉換格式為nsdata,post提交必須用nsdata資料。nsdata postdata post datausingencoding ...
POST提交資料方式
當直接提交form表單時,預設就使用此種方式。這又是乙個常見的 post 資料提交的方式。我們使用表單上傳檔案時,必須讓 form 的 enctyped 等於這個值。上傳資料使用,不過多闡述。json 格式支援比鍵值對複雜得多的結構化資料,這一點也很有用。記得我幾年前做乙個專案時,需要提交的資料層次...
php模擬post提交資料
php模擬post提交資料,用處很多,可用來 的採集,登陸等等。以程式登陸乙個論壇登入為例 php post資料的三種方法 php有三種方法可以post資料,分別為curl socket file get contents socket版本 使用方法 request by socket facebo...