weather/js/search.js
// Build the list of matching locations
Build the list of matching locations
Build the list of matching locations
function processJSON(json) {
  console.log(json);
  let list = "<ul>";
  for (let i = 0, n = json.RESULTS.length; i < n; i++) {
    list += "<li><a data-location='zmw:"+ json.RESULTS[i].zmw +"' href='https://wunderground.com/" + json.RESULTS[i].l + "' title='See weather information for " + json.RESULTS[i].name + "' target='_blank'>" + json.RESULTS[i].name + "</a></li>";
  };
  list += "</ul>";
  searchResults.innerHTML = list;
} 
function processJSON ( json ) { console . log ( json ) ; let list = "<ul>" ; for ( let i = 0 , n = json . RESULTS . length ; i < n ; i ++ ) { list += "<li><a data-location='zmw:" + json . RESULTS [ i ] . zmw + "' href='https://wunderground.com/" + json . RESULTS [ i ] . l + "' title='See weather information for " + json . RESULTS [ i ] . name + "' target='_blank'>" + json . RESULTS [ i ] . name + "</a></li>" ; } ; list += "</ul>" ; searchResults . innerHTML = list ; }
Build the list of matching locations
Build the list of matching locations
// Log what is returned // Build an unordered list // Use a for loop to include the results in list items // Inject list into the searchResults section of the web page // ends the processJSON function