title: How to use JQuery in TWIG (symfony2)
body: <p>I am currently trying to use JQuery in TWIG. My website was created using Symfony2. I currently have a table in TWIG (it works - see below), for which I would like to make use of JQuery in order to make my table columns sortable.</p>
  
  <pre><code>&lt;table&gt;&lt;tr&gt;&lt;th&gt;cat&lt;/th&gt; &lt;th&gt;dog&lt;/th&gt; &lt;th&gt;fish&lt;/th&gt; &lt;/tr&gt; {% for result in results %}&lt;tr&gt;&lt;td&gt;{{result.cat_name}}&lt;/td&gt;&lt;td&gt;{% for dog in result.dogs %} {{dog.dog_name}}{% endfor %} &lt;/td&gt; &lt;td&gt;{% if result.fishs is defined %} {% for fish in result.fishs %}
  {{fish.fish_uri}}
    {% endfor %} {% endif %} &lt;/td&gt;&lt;/tr&gt;{% endfor %}
  </code></pre>
  
  <p></p>
  
  <p>I would like to make use of DataTables (see <a href="http://datatables.net/blog/Getting_started_with_DataTables%3a_First_steps" rel="nofollow">here</a>) in order to get my desired functionality from my table. There's a  bundle (see <a href="https://github.com/opichon/UAMDatatablesBundle/blob/master/README.md" rel="nofollow">here</a>) which was created to allow the use of DataTables in TWIG. The bundle was successfully installed (web/bundles/uamdatatables/).</p>
  
  <p>What causes me uncertainty (as bundle did not have use instructions) is that I have tried to make the bundle work (to make my table have the features offered by DataTables), and yet my table remains unchanged (no error messages either).</p>
  
  <p>Wondering if someone could tell me what I am doing wrong? I have never used JQuery before, and am new to Symfony. Do I need some kind of "include" statement (to get to js files)?</p>
  
  <p>//view.html.twig</p>
  
  <pre><code>&lt;table&gt;&lt;table id="table_id" class="display"&gt;&lt;thead&gt; {% block stylesheets %}
  &lt;link href="{{ asset('/bundles/uamdatatables/css/jquery.dataTables.css') }}" rel="stylesheet" /&gt;
  &lt;script type="text/javascript" charset="utf-8" src="/bundles/uamdatatables/css/jquery.dataTables.css"&gt;&lt;/script&gt;
      {% endblock %}&lt;tr&gt;&lt;th&gt;cat&lt;/th&gt; &lt;th&gt;dog&lt;/th&gt; &lt;th&gt;fishs&lt;/th&gt; &lt;/tr&gt;&lt;/thead&gt; &lt;tbody&gt;&lt;?php $(document).ready( function () {
  $('#table_id').dataTable();} );?&gt;{% block javascripts %}
          &lt;script src="{{ asset('/bundles/uamdatatables/js/jquery.dataTables.js') }}"&gt;&lt;/script&gt;
      {% endblock %}{% for result in results %}&lt;tr&gt;&lt;td&gt;{{ result.cat_name}}&lt;/td&gt;&lt;td&gt;{% for dog in result.dogs %}{{dog.dog_name}}{% endfor %}&lt;/td&gt;&lt;td&gt;{% if result.fishs is defined %} {% for fish in result.fishs %}{{fish.fish_uri}}{% endfor %}{% endif %}&lt;/td&gt;&lt;/tr&gt;{% endfor %}&lt;/tbody&gt; &lt;/table&gt;
  </code></pre>
  
  <p>Thank you!
  Tanya</p>