Skip to content

Instantly share code, notes, and snippets.

@jcnesci
Created June 26, 2014 00:31
Show Gist options
  • Save jcnesci/faaa431f16f9290bf75c to your computer and use it in GitHub Desktop.
Save jcnesci/faaa431f16f9290bf75c to your computer and use it in GitHub Desktop.
Open311 JSONP test #1 - using jQuery
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<title>DudleyD3 - Sosolimited</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
// Based on this jQuery example: http://www.sitepoint.com/jsonp-examples/
(function($) {
var url = 'https://mayors24.cityofboston.gov/open311/v2/services.json?callback=?';
$.ajax({
type: 'GET',
url: url,
async: false,
jsonpCallback: 'jsonCallback',
contentType: "application/json",
dataType: 'jsonp',
success: function(json) {
console.dir(json);
},
error: function(e) {
console.log("error: "+ e.message);
}
});
})(jQuery);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment