NiraParikh il y a 5 ans
Parent
révision
43ab71ded7
1 fichiers modifiés avec 23 ajouts et 0 suppressions
  1. 23
    0
      index.html

+ 23
- 0
index.html Voir le fichier

@@ -39,4 +39,27 @@
39 39
     	<div id="result"></div>
40 40
     </section>
41 41
 </body>
42
+<script type = "text/javascript">
43
+var httpClient=function(){
44
+    var movies;
45
+    var onHttpRequest = new XMLHttpRequest();
46
+    onHttpRequest.onreadystatechange =function(){
47
+        if(onHttpRequest.readyState ==4 && onHttpRequest.status == 200){
48
+            movies = JSON.parse(onHttpRequest.responseText);
49
+            for(var i = 0; i < movies.data.length;i++){
50
+                var movie= movies.data[i];
51
+                if(movie[10]=="Golden Gate Bridge"){
52
+                    document.getElementById('result').innerHTML +=(movie[8]+ " "+movie[9]+" "+movie[12])  + "<br>";
53
+                }
54
+            }
55
+        }
56
+    }
57
+    var theurl='https://data.sfgov.org/api/views/yitu-d5am/rows.json?accessType=DOWNLOAD';
58
+    onHttpRequest.open("GET",theurl,true);
59
+    onHttpRequest.setRequestHeader("Content-Type","text/plain");
60
+    onHttpRequest.send();
61
+    return movies;}
62
+    httpClient();
63
+
64
+</script>
42 65
 </html>