load-json-xhr
v3.0.3
Published
Load json in the browser.
Downloads
32
Maintainers
Readme
load-json-xhr
Loads a JSON file from a URI using xhr. The return object is the XMLHttpRequest.
var load = require('load-json-xhr');
load('my-file.json', function(err, data) {
if (err)
throw err;
console.log(data.foo.bar);
})
Also accepts an options object which is passed along to the xhr
module.
var load = require('load-json-xhr');
load({ uri: 'my-file.json', timeout: 5000 }, function(err, data) {
if (err)
throw err;
console.log(data.foo.bar);
})
Usage
getJSON(opt[, callback])
Gets JSON data from a uri
specified in opt
. Or you can pass a string
.
License
MIT, see LICENSE.md for details.