I'm using ASP.NET MVC4... Out of the box _Layout.cshtml has
@Scripts.Render("~/bundles/jquery")
in it. Also I have the stock BundleConfig.cs which has a
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
in it. I have a script block like this in my Index.cshtml which is just a normal view.
<script src="@Url.Content("~/Scripts/ProductsIndex.js")" type="text/javascript"></script>
But the JQuery in that script does not run... However, if I put the following line in my Index.cshtml, (right next to the ProductsIndex.js script reference) then the JQuery runs fine.
<script src="@Url.Content("~/Scripts/jquery-1.8.2.min.js")" type="text/javascript"> </script>
I know this is something simple, but given that _Layout.cshtml already references the JQuery library, shouldn't I be able to use JQuery without having to add it again to my Index.cshtml explicitly?
ProductsIndex.js.