Skip to content

Instantly share code, notes, and snippets.

@tordans
Last active May 11, 2018 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tordans/e0c3751b29add3dc06eccc66c0a9ddd1 to your computer and use it in GitHub Desktop.
Save tordans/e0c3751b29add3dc06eccc66c0a9ddd1 to your computer and use it in GitHub Desktop.
Rallye: Spendenaktionen Mini-Übersicht
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"></script>
<title>Ralleys</title>
</head>
<body>
<h1>Lade Daten …</h1>
<script>
// Headline
var Datum = new Date();
var Monat = Datum.getMonth() + 1;
$('h1').text("Ralley-Daten vom " + Datum.getDate() + "." + Monat + "." + Datum.getFullYear());
// Tabelle
var ids_from_url_hash = window.location.hash.replace('#','').split(',');
$.each(ids_from_url_hash, function(index, value) {
$(document).ready(function () {
$.getJSON("https://api.betterplace.org/de/api_v4/fundraising_events/"+value+".json", function(data) {
$("#container").append('<tr><td>'+data.id+'</td><td><a href="https://www.betterplace.org/de/fundraising-events/'+data.id+'" target="_blank">'+data.title+'</a></td><td>'+data.donated_amount_in_cents/100+' €</td></tr>');
});
});
});
</script>
<table class="table" id="container">
<tr>
<th>ID</th>
<th>Name</th>
<th>Gesammelt</th>
</tr>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment