De'Jon Johnson преди 6 години
родител
ревизия
0b29d902a6
променени са 2 файла, в които са добавени 27 реда и са изтрити 0 реда
  1. 26
    0
      Index.js
  2. 1
    0
      index.html

+ 26
- 0
Index.js Целия файл

@@ -0,0 +1,26 @@
1
+var request = new XMLHttpRequest();
2
+
3
+request.open('GET', 'https://data.sfgov.org/api/views/yitu-d5am/rows.json?accessType=DOWNLOAD');
4
+
5
+request.onreadystatechange = function() {
6
+		if((request.status === 200) && (request.readyState === 4)){
7
+		console.log(request.responseText)
8
+		var list = JSON.parse(this.responseText);
9
+		let movies = list.data;
10
+
11
+		var newMovies = "";
12
+
13
+		for(let i= 0; i< movies.length; i++){
14
+			if(movies[i].includes("Golden Gate Bridge")){
15
+					newMovies+= "Title: " + movies[i][8] + '<br>';
16
+					newMovies+= "Year: " + movies[i][9] + '<br>';
17
+					newMovies+= "Production Company: " + movies[i][12] + '<br>';
18
+			}
19
+
20
+		}
21
+
22
+		document.getElementById('result').innerHTML += newMovies;
23
+		}
24
+
25
+}	
26
+request.send();

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

@@ -3,6 +3,7 @@
3 3
 <head>
4 4
     <meta charset="UTF-8">
5 5
     <link href="./css/style.css" type="text/css" rel="stylesheet">
6
+    <script src= "Index.js"></script>
6 7
     <title>Import Local JSON Data | Zipcode Wilmington</title>
7 8
 </head>
8 9
 <body>