简体   繁体   English

Javascript参考无法正常工作的ASP.NET开发服务器?

[英]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. 最奇怪的部分是,它很好地引用了我的CSS文件,其他似乎没有任何问题。

//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. 我尝试删除@Url.Content(...)并直接指向目录,但这根本没有任何作用。 Hopefully someone else has run into this issue and has figured out a solution. 希望其他人遇到了这个问题并找到了解决方案。

Using: ASP.NET MVC3 Razor, Visual Studio 2010 Professional 使用: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; 如果您使用的是默认目录设置,那么Scripts文件夹是Content文件夹的子目录; in which case: 在这种情况下:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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