Skip to content

Instantly share code, notes, and snippets.

@apollolm
Created October 6, 2014 04:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apollolm/1c14d9b0efbe2f73f827 to your computer and use it in GitHub Desktop.
Save apollolm/1c14d9b0efbe2f73f827 to your computer and use it in GitHub Desktop.
Tech Diversified - API 101 Starter Page
<!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