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>
1

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.