call json api javascript code example
Example 1: how get a json object from an api in javascript
let url = 'https://example.com';
fetch(url)
.then(res => res.json())
.then((out) => {
console.log('Checkout this JSON! ', out);
})
.catch(err => { throw err });
Example 2: call json api javascript
$.getJSON(
"API URL HERE",
function (data){
console.log(data); // by printing to the console you can easely check all values in the console
//every api related code here...
}