I have a very basic JSON extract seen here.
[
{ first: "bob", last: "jones", },
{ first: "josh", last: "smith", }
]
I am trying to parse this into HTML using $.getJSON.
I have never used this jquery function before and am having issues. My guess is I am missing something in the info div.
I currently have JSON URL in this example but my live code has the actual URL.
Thanks for any guidance, here is my code:
Javascript
$.getJSON('JSON URL', 'limit=5', processNames);
function processNames(data) {
var infoHTML='';
$.each(data, function(name) {
infoHTML += 'First: ' + name.first;
infoHTML += 'Last: ' + name.last;
});
$('#info').html(infoHTML);
}
HTML
<div id="info"></div>