Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- $(document).ready(function(){
- var new_block = function(articleHID, articleHeader, section){
- var stuff = $("#article").clone();
- $(stuff).attr('id', "notheader");
- $(stuff).find('#articleHeader').attr('id',articleHID);
- $(stuff).find('#articleHeader').html(articleHeader);
- $(stuff).find('#sectionList').html(section);
- $(stuff).attr('style', 'visibility: visible;');
- return stuff;
- }
- var loadConstitution = function(d){
- $.each(d[0].articles, function(i, article){
- var articleID = "article" + i;
- var articleHeaderID = "articleHeader" + i;
- var articleHeader = "<p class='lead' id='articleHeader'><strong>Article " + i + "</strong></p>";
- var mySections = article.sections;
- var thisSection = "<dl id='sectionList'>";
- $.each(mySections, function(j, section){
- thisSection +=
- "<dt>Section " + j + "</dt>" +
- "<dd>" + mySections[j] + "</dd>";
- })
- document.write(thisSection);
- thisSection += "</dl>";
- $("#constitutionHolder").append(new_block(articleHeaderID, articleHeader, thisSection));
- })
- }
- //loads the JSON file to the above function
- $.getJSON('data/constitution.json', loadConstitution);
- })
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement