Skip to content

Instantly share code, notes, and snippets.

@tobybellwood
Created November 26, 2014 21:40
Show Gist options
  • Save tobybellwood/5ea3fb1728315e6e6f96 to your computer and use it in GitHub Desktop.
Save tobybellwood/5ea3fb1728315e6e6f96 to your computer and use it in GitHub Desktop.
Working JSONP with data.gov.au // source http://jsbin.com/gajiva
<!DOCTYPE html>
<html>
<head>
<link href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
<meta name="description" content="Working JSONP with data.gov.au" />
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div id = 'JSONFeed' role="main" class="ui-content">
</div>
<script id="jsbin-javascript">
$.getJSON('http://data.gov.au/api/action/datastore_search?limit=1500&resource_id=2d38b209-a499-4b54-bac3-3d89bbc1a789', function(data) {
var text = '<ul data-role="listview">';
$.each(data.result.records, function(i,item){
text += '<li><a href="index.html">'+ item.Fax + '</a></li>';
});
text += '</ul>';
$('#JSONFeed').html(text);
});
</script>
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html>
<head>
<link href="//code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css" rel="stylesheet" type="text/css" />
<script src="//code.jquery.com/jquery-1.11.0.min.js"><\/script>
<script src="//code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"><\/script>
<meta name="description" content="Working JSONP with data.gov.au" />
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div id = 'JSONFeed' role="main" class="ui-content">
</div>
</body>
</html></script>
<script id="jsbin-source-javascript" type="text/javascript">$.getJSON('http://data.gov.au/api/action/datastore_search?limit=1500&resource_id=2d38b209-a499-4b54-bac3-3d89bbc1a789', function(data) {
var text = '<ul data-role="listview">';
$.each(data.result.records, function(i,item){
text += '<li><a href="index.html">'+ item.Fax + '</a></li>';
});
text += '</ul>';
$('#JSONFeed').html(text);
});
</script></body>
</html>
$.getJSON('http://data.gov.au/api/action/datastore_search?limit=1500&resource_id=2d38b209-a499-4b54-bac3-3d89bbc1a789', function(data) {
var text = '<ul data-role="listview">';
$.each(data.result.records, function(i,item){
text += '<li><a href="index.html">'+ item.Fax + '</a></li>';
});
text += '</ul>';
$('#JSONFeed').html(text);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment