mpierse 6 anni fa
parent
commit
86499ce4ec
1 ha cambiato i file con 15 aggiunte e 3 eliminazioni
  1. 15
    3
      JS/index.js

+ 15
- 3
JS/index.js Vedi File

@@ -6,11 +6,23 @@ xmlhttp.open("GET","https://data.sfgov.org/api/views/yitu-d5am/rows.json", true)
6 6
 
7 7
 xmlhttp.onreadystatechange=function() {
8 8
     if (this.readyState==4 && this.status==200) {
9
+      console.log(xmlhttp.response)
9 10
       data=JSON.parse(this.responseText);
10
-    var movies = data.data;
11
-    var firstMovie = movies[i];
11
+     var movies = data.data;
12
+     var result = "";
13
+for (i=0; i<movies.length; i++){
14
+if(movies[i][10]==="Golden Gate Bridge"){
15
+  result += movies[i][8];
16
+  result += " : ";
17
+  result += movies [i][9];
18
+  result += ", ";
19
+  result += movies[i][12];
20
+  result += "<br>";
21
+}
22
+}
23
+document.getElementById('result').innerHTML = result;
24
+
12 25
 
13
-  document.getElementById('result').innerHTML += movies[1][10];
14 26
   }
15 27
 }
16 28
   xmlhttp.send();