<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
function get(url) {
let pro = new Promise(function (resolve, reject) {
let ajax = new XMLHttpRequest()
ajax.open('GET', url, true)
ajax.send()
ajax.onreadystatechange = () => {
if (ajax.readyState === 4) {
if (ajax.status === 200) {
resolve(ajax.response)
} else {
console.log('Request error, error code :'+ ajax.status); }}}})return pro
}
async function getList() {
let res1 = await get('a.json')
let res2 = await get('a.json') console.log(res1+res2); } getList() //async when not presented as a get methodfunction getData() {
// let res = await axios.get('http://47.92.50.43:8888/sys/jslist') // console.log(res.data);
// let res1 = await axios.get('http://47.92.50.43:8888/sys/jslist') // console.log(res1.data);
//}
//getData()
</script>Copy the code