简体   繁体   中英

Javascript references aren't working ASP.NET Development Server?

I'm not sure what's going on here. I've reformed the links in every way I can think of to try and reference my Script libraries, but nothing seems to work.

When I upload it to my web host it works fine, locally it doesn't work at all.

The weirdest part is, it references my CSS files fine and nothing else seems to have any issues.

//Works
<link href="@Url.Content("~/Content/main.css")" rel="stylesheet" type="text/css" />
//Doesn't work
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>

I'm not sure what could be going on here or really even where to debug from here. I've tried removing the @Url.Content(...) and pointing directly to the directory, but that doesn't do anything at all. Hopefully someone else has run into this issue and has figured out a solution.

Using: ASP.NET MVC3 Razor, Visual Studio 2010 Professional

If you're using the default directory setup then your Scripts folder is a sub-directory of the Content folder; in which case:

<script src="@Url.Content("~/Content/Scripts/jquery-1.5.1.min.js")"></script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM