Last active
September 8, 2015 11:05
-
-
Save conormcafee/d56bcdaea1428b9ad6e5 to your computer and use it in GitHub Desktop.
JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"01": { | |
"title": "Title", | |
"content" : [ | |
{ | |
"subTitle": "Super Category" | |
} | |
] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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