movieInfo.js 688B

12345678910111213141516171819202122
  1. var info = new XMLHttpRequest();
  2. info.onreadystatechange = function() {
  3. if (this.readyState == 4 && this.status == 200) {
  4. var infoResponse = info.responseText;
  5. var json = JSON.parse(infoResponse).data;
  6. var list = document.getElementById("result");
  7. for (var i=0; i<json.length; i++){
  8. var obj = json[i];
  9. if (obj[10] == "Golden Gate Bridge"){
  10. var movie = obj;
  11. list.innerHTML+= "<br/>" + obj[8];
  12. list.innerHTML += "<br/>" + obj[9];
  13. list.innerHTML += "<br/>" + obj[12] + "<br/>";
  14. };
  15. }
  16. }
  17. };
  18. var url = "https://data.sfgov.org/api/views/yitu-d5am/rows.json?accessType=DOWNLOAD";
  19. info.open("GET", url, true);
  20. info.send();