1.0.5 • Published 4 years ago

ajax-li v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

ajax

Including

<script src="./dist/ajax.js"></script>

Usage

ajax({
   method:'post',
   url:'http://192.168.6.48/ajax/server2.php',
   data:{name:'list'}, //请求参数
   timeout:10000, //设置请求超时 ms
   // requestHeader: { // 设置请求头
   //     key:'Content-type',
   //     value:'application/x-www-form-urlencoded'
   // }
}).then(res=>{
      console.log( res )
}).catch(err=>{
      console.log( err )
})

API

  1. ajax(data)
    • data.method 请求方式,目前支持 get/post/head
    • data.url url
    • data.data post请求时请求参数。
      {username:"xiaoming"}
    • data.timeout 超时,单位毫秒。可选参数
    • data.header
      {
         key:'Content-type',
         value:'application/x-www-form-urlencoded'
      }
1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago