3.0.3 • Published 9 years ago

load-json-xhr v3.0.3

Weekly downloads
10
License
MIT
Repository
github
Last release
9 years ago

load-json-xhr

stable

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

NPM

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.