0

I have a master page where the jQuery file is included as

<script src="Scripts/jquery-1.9.0.js" type="text/javascript"></script>
  • The master page is in the root directory.
  • The jQuery file is in the folder script.
  • The .aspx page is in the admin folder.

The .aspx page is inheriting the master page. All the links to the stylesheet and scripts file are done in the master page. But the jQuery is not working in the .aspx page unless the jQuery file is loaded in the .aspx page itself.

I tried

<script src="~/Scripts/jquery-1.9.0.js" type="text/javascript"></script>  

and

<script src="/Scripts/jquery-1.9.0.js" type="text/javascript"></script>
fragilewindows
  • 1,394
  • 1
  • 15
  • 26
suman
  • 728
  • 3
  • 10
  • 29
  • possible duplicate of [Proper way to use JQuery when using MasterPages in ASP.NET?](http://stackoverflow.com/questions/731407/proper-way-to-use-jquery-when-using-masterpages-in-asp-net) – iJade Oct 21 '14 at 05:45

1 Answers1

0

Client/browser renders the html/response it received from server, thus its clearly not a matter whether you reference file in aspx or master page as far as you are referencing it correctly.

Note that all external resources referenced in master pages are resolved with context of content/aspx page. Thus if you have content pages in different folders you should use references as absolute url in master page

In master page reference resources as

<script src="~/Scripts/jquery-1.9.0.js" type="text/javascript"></script> 

Please refer the msdn link to see how master page is linked and compiled with content page for rendering the content.

Amitesh
  • 1,507
  • 1
  • 11
  • 19