Search code examples
c#javascripthrefsrc

How can I get the right location for a javascript file?


I want to load jquery script in the header of my cshtml file like this:

<script src="@Href("~/Scripts/js/jquery-1.6.min.js") type="text/javascript">

However, this code gives me http://localhost:1304/Scripts/js/jquery-1.6.min.js%20type=?_=1325728429624 , where it doesn't find the file. The cshtml file is in D:\svn\Web\Healthcare\trunk\test.Web.Healthcare\Areas\Framework\Administration\Entity and the jquery is in D:\svn\Web\Framework\Trunk\test.Web.Framework\Scripts\js. How can I set the src right so that it finds the jquery file?


Solution

  • Don't know the answer in C# sorry, but you do seem to be missing a closing quote at the end of your src attribute - might be contributing to your issues?