Get JSON data from an URL

AJAX request using ES6 Promises

JavaScript

fetch("https://feeds.citibikenyc.com/stations/stations.json", { mode: "no-cors" })
  .then(response => {
    if (response.ok) {
      response.json().then(data => {
        console.log(data);
      });
    } else console.log('Error');
  })
  .catch(error =>
    console.log(error)
  );