https://github.com/imiric/ajax-promise
A lightweight and promise-based XHR wrapper.
https://github.com/imiric/ajax-promise
Last synced: about 1 year ago
JSON representation
A lightweight and promise-based XHR wrapper.
- Host: GitHub
- URL: https://github.com/imiric/ajax-promise
- Owner: imiric
- License: mit
- Created: 2014-02-27T00:43:24.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-02-27T23:21:55.000Z (over 12 years ago)
- Last Synced: 2025-02-22T18:17:25.060Z (over 1 year ago)
- Language: JavaScript
- Size: 133 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE
Awesome Lists containing this project
README
# ajax-promise
A lightweight and promise-based XHR wrapper with minimal dependencies.
This uses native ES6 Promises if available, falling back to a polyfill.
Largely inspired by https://github.com/kaerus-component/ajax.
## Installation
Install with [component(1)](http://component.io):
$ component install imiric/ajax-promise
## API
```js
var ajax = require('ajax-promise');
ajax.get('http://www.reddit.com/r/aww.json', function(response) {
return JSON.parse(response);
}, function(error) {
console.log(error) {
}).then(function(response) {
console.log("JSON:", response);
});
```
## License
[MIT](LICENSE)