12345678910111213141516
  1. var xhr = new XMLHttpRequest();
  2. xhr.open('GET','https://data.sfgov.org/api/views/yitu-d5am/rows.json?accessType=DOWNLOAD');
  3. xhr.onreadystatechange = function(){
  4. if((xhr.status===200) && (xhr.readyState===4)){
  5. let movieData = JSON.parse(xhr.responseText);
  6. let movies = movieData.data;
  7. for(let i = 0; i < movies.length; i++){
  8. let currentMovie = movies[i];
  9. if(currentMovie[10]=='Golden Gate Bridge'){
  10. document.getElementById('result').innerHTML += currentMovie[8] +
  11. ' - ' + currentMovie[9] + ' - ' + currentMovie[12] + '<br>';
  12. }
  13. }
  14. }
  15. }
  16. xhr.send();