miniAjax
1.0.0
迷你 Ajax 库为简单的 Web 应用程序提供 Ajax、jsonp 和就绪功能。
✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
miniAjax中只有3个接口,包括Ajax、jsonp和ready函数:
ajax ( {
url : "./testXhr.php" , //links to server
type : "POST" , //request method
data : { name : "WeideMo" , age : 26 } , //request params
dataType : "json" , //received dataType
success : function ( response , xml ) {
// do something when success
} ,
fail : function ( status ) {
// do something when fail
}
} ) ;
jsonp ( {
url : "https://github.com/WeideMo/" , //links to server
callback : "callback" , //reception callback name negotiated with the backend-server
data : { id : "1000120" } , //request params
success : function ( json ) {
// do something when success
} ,
fail : function ( ) {
// do something when fail
} ,
time : 10000 //custom timeout
} )
ready ( function ( ) {
// do something when page ready
} )
几乎支持所有的浏览器,甚至包括原来的IE系列。
压缩版小于2K,如果使用gzip则小于1K。
MiniAjax 只是满足 Web 开发的基本要求。它只负责三件事: Ajax
、 jsonp
和ready
。
更多原理和用法可以获取 ->https://github.com/WeideMo/jsonp