Best placement for javascript in Asp.net MVC app that heavily uses partial views
- by KallDrexx
What is the best place for javascript that is specific to a partial view? For example, if I have a partial view (loaded via ajax call) with some divs and I want to turn those divs into an accordian, would it be better put the $("#section").accordion() in script tags inside of the partial view, or in a .js file in the function that retrieves that partial view and inserts it into the DOM?
Obviously, common methods I will be keeping in a .js file, however I am more talking about javascript very specific to the partial view itself.
Most things I find on the net seem to say to put all javascript into a separate .js but nothing addresses the idea of partial views.