Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET jQuery not working from subdirectory
    text
    copied!<p>I write ASP.NET application and I want to use jQuery DataTables.</p> <p>In Master Page (which is not in root) I include scripts in code behind:</p> <pre><code>protected override void OnInit(EventArgs e) { base.OnInit(e); ScriptManagerSM.Scripts.Add(new ScriptReference(Page.ResolveUrl("~/js/jquery.min.js"))); ScriptManagerSM.Scripts.Add(new ScriptReference(Page.ResolveUrl("~/js/jquery-ui.min.js"))); ScriptManagerSM.Scripts.Add(new ScriptReference(Page.ResolveUrl("~/js/DataTables/jquery.dataTables.js"))); ScriptManagerSM.Scripts.Add(new ScriptReference(Page.ResolveUrl("~/js/setup.js"))); Page.Header.DataBind(); } </code></pre> <p>In page I have just pure html:<br> <code>&lt;table class="table display"&gt;<br> &lt;thead&gt;<br> &lt;tr&gt;<br> &lt;th&gt;Header&lt;/th&gt;<br> &lt;th&gt;Header 2&lt;/th&gt;<br> &lt;/tr&gt;<br> &lt;/thead&gt;<br> &lt;tbody&gt;<br> &lt;tr class="gradeX"&gt;<br> &lt;td&gt;Cell 1&lt;/td&gt;<br> &lt;td&gt;Cell 2&lt;/td&gt; &lt;/tr&gt;<br> &lt;/tbody&gt;<br> &lt;/table&gt;</code></p> <p>jQuery is called by class selector in my setup.js:<br> <code>$(function() { var oTable = $('.table').dataTable( {<br> "bJQueryUI": true,<br> "sScrollX": "",<br> "bSortClasses": false,<br> "aaSorting": [[0,'asc']],<br> "bAutoWidth": true,<br> "bInfo": true,<br> "sScrollY": "100%",<br> "sScrollX": "100%",<br> "bScrollCollapse": true,<br> "sPaginationType": "full_numbers",<br> "bRetrieve": true<br> } );<br> }); </code></p> <p>Everything is working on pages placed in root. But on pages in subfolders jQuery is not fired. It looks like some path trouble, but I can't see.</p> <p>Thanks for help o..o</p> <p><em>edit: setup script added</em><br> <em>edit 2: added calling of jQuery</em><br> <em>edit 3: added $(function() { to js code above (already existing in my real code, just missing here</em></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload