Created
October 6, 2014 04:35
-
-
Save apollolm/1c14d9b0efbe2f73f827 to your computer and use it in GitHub Desktop.
Tech Diversified - API 101 Starter Page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>TechDiversified Worshop - The Power of APIs</title> | |
</head> | |
<body> | |
<h1>List of 911 Responses</h1> | |
<div id="myResults"></div> | |
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> | |
<script type="text/javascript"> | |
//Use jQuery to call the API and get results | |
$(document).ready(function(){ | |
//This is the URL (address) to the API endpoint you're interested in | |
var URL = "http://data.seattle.gov/resource/kzjm-xkqj.json"; | |
$.getJSON(URL, function(result){ | |
//After the API is successfully called, the flow comes here. | |
$.each(result, function(idx, item){ | |
$("#myResults").append(item.type); | |
$("#myResults").append("<br>"); | |
}); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment