Hi I'm just learning JQuery and while I've got my head around the general
concepts, the real power of the logic it provides is still escaping me.

I've got a page with a JSON dataset like this:

var myData = 
{ records : [ 
{ CATEGORY : "Sport", TITLE : "The world of sport", LINK: "http://test.com";
}, 
{ CATEGORY : "Sport", TITLE : "More sport", LINK: "http://test.com"; },
{ CATEGORY : "News", TITLE : "News views", LINK: "http://test.com"; },
{ CATEGORY : "News", TITLE : "Some more news", LINK: "http://test.com"; },
{ CATEGORY : "Events", TITLE : "Big Events", LINK: "http://test.com"; },
{ CATEGORY : "Events", TITLE : "Small Events", LINK: "http://test.com"; },
]}

Now this is being built into a nested list using Jquery, however at the
moment I'm hardcoding the category names in my script and looping through
each title.

I'm now hitting increasing issues as if categories are added/removed it
become a chore to update.

Can anyone tell me if it's possible to automatically generate a list of
unique categories?

ie so it'd produce this:

<ul>
<li>Sport</li>
<li>News</li>
<li>Events</li>
</ul>

Not:
<ul>
<li>Sport</li>
<li>Sport</li>
<li>News</li>
<li>News</li>
<li>Events</li>
<li>Events</li>
</ul>

-- 
View this message in context: 
http://www.nabble.com/Make-%3Cli%3E-list-of-unique-json-data--tp21054524s27240p21054524.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to