There are a few pages here addressing usage of jQuery with .net masterpages – fewer re: masterpages in MVC in .net MVC apps. But those few seem to be making distinctions re pre-release versions of MVC.
Is there now a consensus regarding how and where to include the lib and what potential problems we need to be aware of?
It _looks as though things are fairly straight forward…put the include in the masterpage’s head and stuff works. (as it has for me _so far). I guess I’m looking for lessons learned and what to watch out for – i haven’t scratched features like partial views and ajax yet.
thx
There’s no magic way to include jQuery. Since it’s a client-side library, including it in the master page makes it easy to hook into $(document).ready from any view or partial view.
Once it’s at the top of your page, it’s trivial to include plugins or hook into events at any point. That way, you can encapsulate jQuery that is specific to your application in the view or partial view itself.