I am using intel's app framework. I got the following snippet from another answer(on jquery mobile) in stack overflow. But it is for jquery mobile and it had a function to refresh the listview after appending.
As I am in the learning stage, I couldn't figure out how to append the JSON data to a list view and refresh it. It will be a great help if someone could help me with this.
On running this code, I am getting the following error in my console. Also I would like to know if there is an alternative to Jquery Mobile's .listview('refresh') function.
Uncaught ReferenceError: items is not defined
$.each(data.mycontent, function(key, val) {
items.push('<li id="' + key + '">' + val + '</li>');
});
$('<ul/>', {
html: items.join('')
}).appendTo('#mylist');
My JSON data is in the following format
{"mycontent":{"content_id":"5","body":"foo content","heading":"My list heading"}