0.2.1 • Published 10 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-fetchvar nanoFetch = require('nano-fetch');API
nanoFetch(url[, options])
urlis an absolute or relative URLoptionsis an object with the properties:
Dependencies
None
License
MIT © Federico Brigante