// grab ul element out of DOM
var tourList = document.getElementById("tourList");
// instantiate Objects API
new oa.api.OOIs(
{
// list of string ids (just the ids of two tours)
idlist: [ '1397449', '5345254' ],
// only load basic tour data from backend
// (to save bandwidth)
lightweightApp: 'tour'
}
// tell the Obejcts API to load the data
).load( onLoad );
// onload callback
function onLoad( status, oois ) {
// do something with the loaded ooi data
for(var i=0; i<oois.length; i++) {
// create a new list item for each loaded tour
li = document.createElement("li");
// fill the list item with id, title and distance of the loaded tour
li.innerHTML = "Id "+ oois[i].id + ": " + oois[i].title + ", Distance " + Math.round(oois[i].length) + " m";
// append list item to unordered list
tourList.appendChild(li);
}
}