README
xhr-tool
Install the package like this:
npm install xhr-tool
Import the function
var getJSON = require('xhr-tool').getJSON;
Needs a browser that supports Promises or a Promise polyfill.
getJSON
getJSON(url) → Promise → Object
Sends an asynchronous request and returns a Promise for the parsed JSON response
Example usage:
getJSON('http://www.nactem.ac.uk/software/acromine/dictionary.py?sf=BMI').then(function(obj) {
console.log(obj);
});