NiraParikh преди 5 години
родител
ревизия
43ab71ded7
променени са 1 файла, в които са добавени 23 реда и са изтрити 0 реда
  1. 23
    0
      index.html

+ 23
- 0
index.html Целия файл

39
     	<div id="result"></div>
39
     	<div id="result"></div>
40
     </section>
40
     </section>
41
 </body>
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
 </html>
65
 </html>