get-json-data

Make ajax request to get the json data.

Usage no npm install needed!

<script type="module">
  import getJsonData from 'https://cdn.skypack.dev/get-json-data';
</script>

README

get-json-data

Make ajax request to get the json data from browser. Not for nodejs, use request module instead.

usage

can not be more simpler:

include index.js in your html.

getJSONData(url,callback);
//callback function 
fucntion callback(err, data) {
  if (err) {
    console.log('request failed');
    return;
  }
  // do something with data
}

note

This module does not support jsonp. For jsonp request you may use jsonp module.

similar

Here is list of other popular and stable projects

License

This project is licensed under the terms of the MIT license.