Skip to content

Instantly share code, notes, and snippets.

@conormcafee
Last active September 8, 2015 11:05
Show Gist options
  • Save conormcafee/d56bcdaea1428b9ad6e5 to your computer and use it in GitHub Desktop.
Save conormcafee/d56bcdaea1428b9ad6e5 to your computer and use it in GitHub Desktop.
JSON
{
"01": {
"title": "Title",
"content" : [
{
"subTitle": "Super Category"
}
]
}
}
$(function() {
$.getJSON('01-control-panel.json', function(data) {
$.each(data, function(i, a) {
var output = '<div>' +
'<p>' + a.title + '</p>' + '<ul>{content}</ul>' + '</div>';
var li = '';
$.each(a.content, function(i, a) {
li += "<li>" + a.subTitle + "</li>";
});
output = output.replace('{content}', li);
$(output).appendTo(".div-class");
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment