ソースを参照

json conquered

jacob andersen 7 年 前
コミット
7196fc5432
共有8 個のファイルを変更した72 個の追加1 個の削除を含む
  1. 9
    0
      .idea/JSON-Lab-2.iml
  2. 4
    0
      .idea/encodings.xml
  3. 6
    0
      .idea/misc.xml
  4. 8
    0
      .idea/modules.xml
  5. 6
    0
      .idea/vcs.xml
  6. 16
    0
      .idea/workspace.xml
  7. 21
    0
      GetMovies.js
  8. 2
    1
      index.html

+ 9
- 0
.idea/JSON-Lab-2.iml ファイルの表示

@@ -0,0 +1,9 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module type="JAVA_MODULE" version="4">
3
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+    <exclude-output />
5
+    <content url="file://$MODULE_DIR$" />
6
+    <orderEntry type="inheritedJdk" />
7
+    <orderEntry type="sourceFolder" forTests="false" />
8
+  </component>
9
+</module>

+ 4
- 0
.idea/encodings.xml ファイルの表示

@@ -0,0 +1,4 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="Encoding" addBOMForNewFiles="with NO BOM" />
4
+</project>

+ 6
- 0
.idea/misc.xml ファイルの表示

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="JavaScriptSettings">
4
+    <option name="languageLevel" value="ES6" />
5
+  </component>
6
+</project>

+ 8
- 0
.idea/modules.xml ファイルの表示

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/.idea/JSON-Lab-2.iml" filepath="$PROJECT_DIR$/.idea/JSON-Lab-2.iml" />
6
+    </modules>
7
+  </component>
8
+</project>

+ 6
- 0
.idea/vcs.xml ファイルの表示

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="" vcs="Git" />
5
+  </component>
6
+</project>

+ 16
- 0
.idea/workspace.xml ファイルの表示

@@ -0,0 +1,16 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectFrameBounds">
4
+    <option name="y" value="23" />
5
+    <option name="width" value="1280" />
6
+    <option name="height" value="722" />
7
+  </component>
8
+  <component name="PropertiesComponent">
9
+    <property name="WebServerToolWindowFactoryState" value="false" />
10
+    <property name="android.sdk.path" value="$USER_HOME$/Library/Android/sdk" />
11
+    <property name="aspect.path.notification.shown" value="true" />
12
+    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
13
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
14
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
15
+  </component>
16
+</project>

+ 21
- 0
GetMovies.js ファイルの表示

@@ -0,0 +1,21 @@
1
+var xhr = new XMLHttpRequest();
2
+xhr.open("GET","https://data.sfgov.org/api/views/yitu-d5am/rows.json?accessType=DOWNLOAD");
3
+xhr.send();
4
+xhr.addEventListener("readystatechange", processRequest, false);
5
+
6
+xhr.onreadystatechange = processRequest;
7
+
8
+function processRequest()
9
+{
10
+  if (xhr.readyState == 4 && xhr.status == 200)
11
+  {
12
+  response = JSON.parse(xhr.responseText);
13
+
14
+    for (i=0; i<1622; i++)
15
+    {
16
+      if(response.data[i][10] == "Golden Gate Bridge")
17
+      document.getElementById("result").innerHTML += "Title: "+(response.data[i][8]+"<br>"+"Production year: "+response.data[i][9]+"<br>"+" Location: "+response.data[i][10]+"<br>"+"<br>");
18
+
19
+  }
20
+}
21
+}

+ 2
- 1
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="GetMovies.js"></script>
6 7
     <title>Import Local JSON Data | Zipcode Wilmington</title>
7 8
 </head>
8 9
 <body>
@@ -39,4 +40,4 @@
39 40
     	<div id="result"></div>
40 41
     </section>
41 42
 </body>
42
-</html>
43
+</html>