Similar to some previous questions, I'm trying to use jQuery in a visual web part but I keep getting that jQuery is undefined. I've added the jQuery script to SiteAssets as well as a script folder inside my visual webpart project, and tried referencing it in the ascx file with both:
<script src="~sitecollection/SiteAssets/jquery-1.9.1.min.js"></script> <script src="./Scripts/jquery-1.9.1.min.js"></script>
And also in code behind, in the Page_Load method, with lines such as:
this.Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "custJquery1", "~/SiteAssets/jquery-1.9.1.min.js"); this.Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "custJquery2", "~sitecollection/SiteAssets/jquery-1.9.1.min.js"); this.Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "custJquery2", "/SiteAssets/jquery-1.9.1.min.js");
I've also tried not referencing jQuery anywhere because I thought maybe the page (Discussion board topics) I'm using the webpart may already have jQuery on it.
All I ever get is the alert that 'jQuery didnt load'. What might be wrong?