Created
November 28, 2013 01:29
-
-
Save markcode/7685950 to your computer and use it in GitHub Desktop.
get json and for each using jquery
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
$.getJSON('http://localhost:8888/data.json', function(data) { | |
var items = []; | |
$.each(data, function(key, val) { | |
items.push('<li id="' + key + '">' + val + '</li>'); | |
}); | |
$('<ul/>', { | |
'class': 'my-new-list', | |
html: items.join('') | |
}).appendTo('body'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment