Home > DeveloperSection > Forums > Where to load JS Scripts in MVC
alexander sabato
alexander sabato

Total Post:4

Posted on    February-12-2013 2:31 AM


 1 Reply(s)
 1457  View(s)
Rate this:


I am fairly new to MVC and I have noticed a lot of inconsistencies with loading js files I have written and tried to load.

To start, here is how I have my website setup:

_Layout.cshtml (main page)
_MainMenu.cshtml (partial view)

I render my MainMenu in the body of Layout. All jquery scripts are loaded in the footer of layout (I read somewhere that was preferrable).

When I render a view, I load any specific scripts related to that content at the top of the view.

What is the best way to go about loading javascript files (whether it's cdn files from google or files included in my project)? Should I load all of them in

the header of my layout page, or just load them as I use them? Can someone please explain the best practice and managing/loading/using javascript files in

an mvc application.

Thank you for your input!


Total Post:604

Posted on    February-12-2013 8:53 AM

Hi Alexander!

Open below URL and read full article, that provide you complete information related to manage styles and scripts files in MVC.

Modified On Feb-12-2013 08:55:11 AM

Don't want to miss updates? Please click the below button!

Follow MindStick