Selaa lähdekoodia

saving changes

Lauren Green 7 vuotta sitten
vanhempi
commit
38536e0a33
2 muutettua tiedostoa jossa 13 lisäystä ja 3 poistoa
  1. 5
    3
      index.html
  2. 8
    0
      index.js

+ 5
- 3
index.html Näytä tiedosto

14
 
14
 
15
     <article>
15
     <article>
16
         <h1>Instructions</h1>
16
         <h1>Instructions</h1>
17
-        <p>Us the <code>XMLHttpRequest()</code> to receive the remote json feed from the following website<br>
17
+        <p>Use the <code>XMLHttpRequest()</code> to receive the remote json feed from the following website<br>
18
         https://data.sfgov.org/api/views/yitu-d5am/rows.json?accessType=DOWNLOAD
18
         https://data.sfgov.org/api/views/yitu-d5am/rows.json?accessType=DOWNLOAD
19
         </p>
19
         </p>
20
 
20
 
36
 
36
 
37
     <section>
37
     <section>
38
     	<h1>Movie Information</h1>
38
     	<h1>Movie Information</h1>
39
-    	<div id="result"></div>
39
+    	<div id="result">
40
+      <script type="text/Javascript" src="index.js"></script>
41
+      </div>
40
     </section>
42
     </section>
41
 </body>
43
 </body>
42
-</html>
44
+</html>

+ 8
- 0
index.js Näytä tiedosto

1
+var request = new XMLHttpRequest();
2
+
3
+request.open('GET', 'https://data.sfgov.org/api/views/yitu-d5am/rows.json?accessType=DOWNLOAD');
4
+request.onreadystatechange = function() {
5
+  if((request.status == 200) && (request.readyState == 4)) {
6
+    document.getElementById('result').innerHTML += request.responseText;
7
+  }
8
+}