12345678910111213141516171819202122 |
- var xhr = new XMLHttpRequest();
- xhr.open("GET","https://data.sfgov.org/api/views/yitu-d5am/rows.json?accessType=DOWNLOAD");
- xhr.send();
- xhr.addEventListener("readystatechange", processRequest, false);
-
- xhr.onreadystatechange = processRequest;
-
- function processRequest()
- {
- if (xhr.readyState == 4 && xhr.status == 200)
- {
- response = JSON.parse(xhr.responseText);
-
- for (i=0; i<1622; i++)
- {
- if(response.data[i][10] == "Golden Gate Bridge")
- document.getElementById("result").innerHTML += "Title: "+(response.data[i][8]+"<br>"+"Production year: "+response.data[i][9]+"<br>"+" Location: "+response.data[i][10]+"<br>"+"<br>");
-
- }
- }
- }
|