• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts

5、axios

5.1、什么是 axios

爱可信是专注于网络数据请求的库

相比于原生的XMLHttpRequest对象,axios简单易用

相比于jQuery,axios更加轻量化,只专注于网络数据请求

5.2、axios 发起 GET

爱可信发起得到请求的语法:

axios.get('ur1 ',{params:{/*参数*/}}).然后(回拨)

代码演示:

var URL=' http://www。刘龙斌。' top :3006/API/get '

var paramsobj={ name: 'zs ',age: 20 }

axios.get(url,{ params: paramsobj }).然后(函数(e) {

控制台。日志(电子数据);

})

5.3、axios 发起 POST请求

语法格式:

axios.post('ur1 ',{ /*参数*/}).然后(cal1back)

代码演示

var URL=' http://www。刘龙斌。'前:3006/API/post '

var paramsobj={ name: 'zs ',age: 20 }

axios.post(url,paramsobj).然后(函数(e) {

控制台。日志(电子数据);

})

5.4、直接使用 axios 发起请求

语法格式:

axios ({

方法: '请求类型,

url: '请求的统一资源定位器地址,

data:{ /* PosT数据*/},

params:{/* GET参数*/}

)}.然后(回拨)

Link to comment
Share on other sites