I have a json array that I select with ajax call and would like to skip it. The array displays the category category and some data records in this category. The array is as follows:
{"Travel":[{"title":"Beautiful title 1"},{"title":"Beautiful title 2"},{"title":"Beautiful title 3"}],"Other":[{"title":"Beautiful title 1"}]}
A basic function like me cannot help me.
$.each(data, function(key, value) {
console.log(value.title);
}
I want to be able to display it with the title of the main category and below it that display the data.
So, for example, I want it to look like this:
Travel (3 results):
- Beautiful title 1
- Beautiful title 2
- Beautiful title 3
- List item
Other (1 result):
Any help would be greatly appreciated. Thank.
source
share