Encountered such problem: Ive created a new blank project of ASP.NET MVC site. Then I
m trying to add a reference to jquery-1.3.2.js from Masterpage head. But in this case, page doesnt loading to browser. I
ve 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?
views:
169answers:
3Why not reference teh jquery on the google or Microsoft cdn ?
From you master page is a good place to do this, correct syntax in links.
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.
You should be able to in 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.2js") %>" type="text/javascript"></script>
Should work though...