Skip to content

Instantly share code, notes, and snippets.

@vertis
Created February 21, 2010 07:39
Show Gist options
  • Save vertis/310189 to your computer and use it in GitHub Desktop.
Save vertis/310189 to your computer and use it in GitHub Desktop.
<html>
<head>
<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript">
function getItems(path) {
$.getJSON(path,
function(data){
$.each(data.dataPackage.dataObject, function(i,item){
$("#results").append("<a href=\"#\" onclick='link(\""+item.relationshipsUri+"\");'>"+item.properties.object_name+"</a><br/>")
});
});
}
function getRelationships(path) {
$.getJSON(path,
function(data){
$.each(data.relationship, function(i,item){
$("#results").append("<a href=\"#\" onclick='link(\""+item.target.relationshipsUri+"\");'>"+item.target.properties.object_name+"</a><br/>")
});
});
}
function link(url) {
//Needs to be a local path...this is a hack
//http://127.0.0.1:8080
var path = url.substring(21, url.length);
alert(path);
$("#results").html("");
getRelationships(path);
}
$(document).ready(function() {
getItems("/resources/core/repositories/test_repo/folders.json");
});
</script>
</head>
<body>
<div id="results">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment