iterate thru jquery template

My json object has multiple categories i.e

[{"Category":"High School",
"Schools":
[.....................

            ]
},

{"Category":"Middle School",
"Schools":
[.....................

            ]
}]

How do I get all the categories where I have  ${Category}. Right now for each category a fresh dropdown div is created for each school category.

<script id="Districtstemplate" type="text/x-jquery-tmpl"> 
    <div class="dropdown">
    
    <div class="submenu1">
        
       

    <div class="submenu">
    
    <div class="header">
        Categories
    </div>
           
            
            
        
    <ul class="root">
   
    <li ><a href="#" >
         
             ${Category}
        
                                       </a></li>
             
            </ul>
       
        
        </div>
 </div>
 </div>
    
</script>

Open in new window

sanagarwlAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
Julian HansenCommented:
What are you trying to achieve?
0
 
Derek JensenCommented:
Are you saying you want a single indented dropdown, such as is often used for forum 'Jump to Page' dropdowns?
0
 
sanagarwlAuthor Commented:
here's what the dropdown looks like

Middle School
Elementary school
Junior school
....
....

mousing over Middle school shows all the Middle schools, same with Elementary Schools ...
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Derek JensenCommented:
Okay...so that sounds like an expanding dropdown on mouseover; I'd start with looking at navigation subtab trees, and modifying one to fit your needs. Should be fairly straightforward from the base code. It sounds like all you'd need to do is add the dynamic navigation options to it from your json.
0
 
sanagarwlAuthor Commented:
I have my json object with the url - I just need to know the syntax for iterating through the category element in the json.

I could always create a parent to the category element in the json and then do

{{each categories}}
${$value.Name}
{{/each}}

But I should not have to do that - I'm looking for something like

{{each .}}
${$value.Name}
{{/each}}

and this should give me
Middle School
High School
Elementary School

I have worked with xslt transformations and doing things of this nature were quite simple but somehow jquery tmplating syntax leaves much to be desired...

thanks for looking into this
0
 
Derek JensenCommented:
Have you tried using the .each() call? Perhaps that might be what you're looking for...??
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
sanagarwlAuthor Commented:
thanks - that worked
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.