I am currently building a navigation menu for my site. I plan on using twitter bootstrap to do so and would like to use jQuery to the html output as desired.
I am already querying all the information needed from my database using php and I have it set as variables for another area of the site, so what I'm doing is just json encoding those arrays and then will be using the jQuery to manipulate the data. There will be both categories and subcategories so I'm pulling in two different php arrays.
I know this can be done in PHP in much of the same manner, but you can't learn if you don't do. So I'm just wondering if there is an easier way to get this done or if I should probably just stick to using php for this.
Sorry if my code is a little messy and I know it's not commented out like it should be.
Thanks for any advice.
var categoryArray = <?php echo json_encode($menu); ?>;
var subcategoryArray = <?php echo json_encode($subcategories); ?>;
for(i=0; i < categoryArray.length; i++)
for(j=0; j < subcategoryArray.length; j++ )
if(subcategoryArray[j]['Category']['id'] === categoryArray[i]['Category']['id'])