0.0.6 • Published 8 years ago

huazaierli-ajax v0.0.6

Weekly downloads
1
License
ISC
Repository
github
Last release
8 years ago

一个小型的ajax库,没有使用jquery,减少加载Jquery库的时间,也不用负担Jquery复杂的逻辑处理带来的性能消耗。其中整合jsonp,方便跨域。

示例:

ajax({
    type:"post",
    url:"", //添加自己的接口链接
    timeOut:5000,
    before:function(){
      console.log("before");  
    },
    success:function(str){
        console.log(str);
    },
    error:function(){
        console.log("error");
    }
});

参数表:

参数默认值描述可选值
url""请求的链接string
typeget请求的方法get,post
datanull请求的数据object,string
contentType""请求头string
dataType""请求的类型jsonp
asynctrue是否异步blooean
timeOutundefined超时时间number
beforefunction(){}发送之前执行的函数function
errorfunction(){}请求报错执行的函数function
successfunction(){}请求成功的回调函数function

详细的说明,请看这里

0.0.6

8 years ago