Hi Guys,
I have a queston that when I am putting in my Index.cshtml then JQuery is loading properly,
however when I am keeping it inside as below. It's doesn't load/work.
@section scripts{
@Scripts.Render("~/Scripts/jquery-1.10.2.js") //Doesn't work
}
@Scripts.Render("~/Scripts/jquery-1.10.2.js") //Doesn't work
}
Interestingly, one more JS file is loading is either ways.
//Works
@section scripts{
@Scripts.Render("~/Scripts/jquery.unobtrusive-ajax.js") //Works
}
@Scripts.Render("~/Scripts/jquery.unobtrusive-ajax.js") //Works
}
Any idea why it's happening like this? Is it related to timing/sequence or there is something else?
Thanks

Saineshwar BageriPosted Feb 8, 2015, 11:46 PM
You should be using @Url.Content() helper (We're not in ASP.NET any more, toto).
Another option is to use the Microsoft.AspNet.Web.Optimization package and create bundles:
**BundleConfig.cs
public void RegisterBundles(BundleCollection bundles)
{
// ...
bundles.Add(new ScriptBundle("~/js/site").Include(
"~/Scripts/jquery-2.0.3.min.js",
"~/Scripts/easing.js",
"~/Scripts/bootstrap.js"
));
// ...
}
Then in your page use:
@Scripts.Render("~/js/site")
Mark as answer if it resolve you issue
Prakash TripathiPosted Feb 10, 2015, 12:18 AM