https://github.com/weidemo/miniajax
🚀A mini Ajax library provides Ajax, jsonp and ready features for simple web applications.
https://github.com/weidemo/miniajax
ajax jsonp mini-ajax-library
Last synced: 11 months ago
JSON representation
🚀A mini Ajax library provides Ajax, jsonp and ready features for simple web applications.
- Host: GitHub
- URL: https://github.com/weidemo/miniajax
- Owner: WeideMo
- License: mit
- Created: 2018-01-31T01:36:14.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-08-05T08:45:00.000Z (over 6 years ago)
- Last Synced: 2025-04-02T05:23:02.248Z (12 months ago)
- Topics: ajax, jsonp, mini-ajax-library
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 68
- Watchers: 10
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# miniAjax
A mini Ajax library provides Ajax, jsonp and ready features for simple web applications.

## Browsers support
|  |  |  |  |  |  |
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
| ✔ | ✔ | ✔ | ✔ | ✔ | ✔
## Usage
There are only 3 interfaces in miniAjax, including Ajax, jsonp and ready functions:
### ajax
```javascript
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
```javascript
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
```javascript
ready(function(){
// do something when page ready
})
```
## Fetures
### High coverage of browsers
Almost support all of the browsers, even the original IE series.
### light Weight
The compressed version is less than 2K, if you use gzip, it will be less than 1K.
### Pure
MiniAjax is just the basic requirement to meet web development.It's only responsible for three things: `Ajax` , `jsonp` and `ready`.
## More
You can get more principles and usage ->[https://github.com/WeideMo/jsonp](https://github.com/WeideMo/jsonp)