I have a json object(stored in a separate file) as follows -
"albums":{
"The Wall" : "1979",
"Pulse" : "1995",
"Meddle" : "1971",
"Animals" : "1977"
}
I want this to be dynamically appended in my DOM as below -
<div>
<p>Key on index i<p>
<p>Value on index i<p>
</div>
The entire div structure should render dynamically as many times as there are entries in the JSON ( in this case 4 times ).
$.getJSON("albums.json",
function (data) {
$.each(data , function (i) {
//append logic here
})
How to achieve this?