Skip to content

Instantly share code, notes, and snippets.

@jneves
Created November 7, 2011 16:43
Show Gist options
  • Save jneves/1345471 to your computer and use it in GitHub Desktop.
Save jneves/1345471 to your computer and use it in GitHub Desktop.
Simple test of dados.gov.pt API
<html>
<head>
<title>Tutorial Dados.gov.pt!</title>
<script type="application/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="application/javascript">
function aminhafuncao(data) {
res = "<table><tr><th>DRE</th><th>Concelho</th><th>Número de Alunos</th></tr>";
for(row in data.d) {
res = res + "<tr><td>" + data.d[row].dre + "</td><td>" + data.d[row].concelho + "</td><td>" + data.d[row].total + "</td><tr>";;
}
res = res + "</table>";
$('#resultados').html(res);
}
</script>
<style>
table { border: 1px solid black; padding: 8px; border-collapse: collapse; }
tr { padding: 0px; margin: 0px; }
td, th { border: 1px solid black; padding: 8px; margin: 0px;}
</style>
</head>
<body>
<h2>Tutorial Dados.gov.pt!</h2>
<h2>Número de alunos por Concelho</h2>
<div id="resultados">
</div>
<script type="application/javascript" src="http://servico.dados.gov.pt/v1/gepe/Alunos20072008?format=json&callback=aminhafuncao"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment