Fetch Example
fetch is bettah than xmlhttprequest. big brodda ay
by George Obregon
JavaScript
/* const cityJobsData = fetch("https://api.myjson.com/bins/a026n");
cityJobsData
.then(data => data.json())
.then(data => {
const countryFrequency = data.reduce((countries, value) => {
countries[value.destinationcountry] = countries[value.destinationcountry] ? countries[value.destinationcountry] + 1 : 1;
return countries;
}, {});
console.log(countryFrequency);
})
.catch(err => console.log(err));
*/
fetch('https://api.myjson.com/bins/a026n').then(
function(response){
return response.json();
}
).then(function(jsonData){
//handle json data processing here
console.log(jsonData);
});