publicdrum logo Back

Using Javascript to dislpay data retreived in JSON format


Working with JS data as Publicdrum

This page contains javascript code to show common ways of using JSON data retreived from Publicdrum

First, a call to Publicdrum loads your requested data into an array.

First, call the Publicdrum API and request your data. In this example, the call is:

http://publicdrum.aactmad.org/api/135/s/json/options:p=w

Then, once you have the data, you can display it on your page. This code counts the number of records retreived.

Examples of how to use the data.

This Code loops through the array and displays some of the available fields.

Grouping - you can use logic to make it look nicer

For example, if the date is the same for a series of events, don't print it out. (Same with time.)

Accumulate

Another technique is to create a second array that contains the grouped data. Some times this is an easier way to display data - for instance, collect all the events for a day into one array element.