0.2.1 • Published 8 years ago
nano-fetch v0.2.1
nano-fetch
A tiny window.fetch-like promise-based AJAX implementation
It's based on XMLHttpRequest
so refer to its documentation for the expected output. It defaults to JSON output and GET requests.
Usage
nanoFetch('page.php').then(function (jsonResponse) {
//...
}).catch(function (error) {
//...
});
nanoFetch('page.php', {
responseType: 'document',
method: 'POST'
}).then(function (documentElement) {
//...
}).catch(function (error) {
//...
});
With browserify
npm install --save nano-fetch
var nanoFetch = require('nano-fetch');
API
nanoFetch(url[, options])
url
is an absolute or relative URLoptions
is an object with the properties:
Dependencies
None
License
MIT © Federico Brigante