123456789101112131415161718192021222324252627
  1. var request = new XMLHttpRequest();
  2. request.open('GET', 'https://data.sfgov.org/api/views/yitu-d5am/rows.json?accessType=DOWNLOAD');
  3. request.onreadystatechange = function() {
  4. if((request.status === 200) && (request.readyState === 4)){
  5. console.log(request.responseText)
  6. var list = JSON.parse(this.responseText);
  7. let movies = list.data;
  8. var newMovies = "";
  9. for(let i= 0; i< movies.length; i++){
  10. if(movies[i].includes("Golden Gate Bridge")){
  11. newMovies+= "Title: " + movies[i][8] + '<br>';
  12. newMovies+= "Year: " + movies[i][9] + '<br>';
  13. newMovies+= "Production Company: " + movies[i][12] + '<br>';
  14. }
  15. }
  16. document.getElementById('result').innerHTML += newMovies;
  17. }
  18. }
  19. request.send();