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