Encountered such problem: Ive created a new blank project of ASP.NET MVC site. Then Im trying to add a reference to jquery-1.3.2.js from Masterpage head. But in this case, page doesnt loading to browser. Ive bee trying and src="<%=Url.Content ("~/Scripts/jquery-1.3.2.js") %>", all the same. Then I moved the script reference to the end of the , and the page began to load. But i need to use jQuery earlier, in ContentPlaceHolders. What is the problem?
3 Answers
You should be able to insert it into the head of the master page reference it.
have you tried just hard coding the source value?
<script src="/scripts/jquery-1.3.2.js" type="text/javascript"></script>
of course your path may be different...
<script src="<%= Url.Content("~/scripts/jquery-1.3.2.js") %>" type="text/javascript"></script>
Should work though...
3 Comments
m very very sorry! Im an idiot. I`ve typed <script blah.. /> instead of <script blah.. ></script>I think based on the way a blank project is made using the default project template for ASP.NET MVC you'd need it to do this:
src="<%=Url.Content ("~/Content/Scripts/jquery-1.3.2.js") %>"
All resources are put in the Content folder by default, unless you've changed that or I'm just remembering incorrectly.
Either way, when the page renders check the html source and see what the src attribute gets evaluated to, and make sure that's correct. I had the same problem once and that's what it turned out to be.
m very very sorry! Im an idiot. I`ve typed <script blah.. /> instead of <script blah.. ></script>