Hmmm... struggling to read from this new dataset using the code provided - can someone point out the stupidity in the following code:
<html> <head> <script type="text/javascript"> 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" }, ]}; </script> <script type="text/javascript" src="jquery.js"></script> </head> <body> <div id="container"> <ul> <li>test</li> </ul> </div> <script type="text/javascript"> // Group categories dynamically into datasets var categories = {}, groupBy = "CATEGORY"; $.each(myData.records, function(i, record) { if (!categories[record[groupBy]]) categories[record[groupBy]] = []; categories[record[groupBy]].push(record); }); //total number of categories var categoryCount = myData.records.length-1; // Append categories to unordered list item for (i=0;i<=categoryCount;i++) { $("ul").append("<li>"+categories.records[i].CATEGORY+"</li>"); } </script> </body> </html> -- View this message in context: http://www.nabble.com/Make-%3Cli%3E-list-of-unique-json-data--tp21054524s27240p21069670.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.