Skip to content

Instantly share code, notes, and snippets.

@markcode
Created November 28, 2013 01:29
Show Gist options
  • Save markcode/7685950 to your computer and use it in GitHub Desktop.
Save markcode/7685950 to your computer and use it in GitHub Desktop.
get json and for each using jquery
$.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