Skip to content

Instantly share code, notes, and snippets.

@DruidSmith
Last active December 28, 2015 06:59
Show Gist options
  • Save DruidSmith/7460907 to your computer and use it in GitHub Desktop.
Save DruidSmith/7460907 to your computer and use it in GitHub Desktop.
JQuery Test
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function () {
$("button").click(function (){
$.ajax({
type:'GET',
url: "http://ofmpub.epa.gov/enviro/frs_rest_services.get_facilities?city_name=Sauget&state_abbr=IL&facility_name=AFTON&output=jsonp",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (callback) {
$.each(result, function (i, field) {
$("div").append(field + " ");
});
},
error: function (errormessage) {
alert("Error!")
}
});
});
});
</script>
</head>
<body>
<button>Get JSON data</button>
<div></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment