Basic fetch example

by Nick Hulea

HTML

<div>
  Updated:
  <span id="updated-time"></span>
</div>

JavaScript

var URL = 'https://spreadsheets.google.com/feeds/cells/1-uOAhx23qal5rjTPgq-Cv5aacyVS-OxMO8sDGJKRiP8/1/public/full?alt=json';
fetch(URL)
  .then(function(res) {
    return res.json();
  }).then(function(json) {
    json.feed.entry.forEach(function(item, index) {  
      console.log(item)
      if (item.title.$t.indexOf("A28") !== -1) {
        var d = item.content.$t.replace('UPDATED ', '');
        document.getElementById("updated-time").innerHTML = d;
     }
    })
  }).catch(function(error) {
    console.error(error);
  });