title: Include template file with different variable value on click - Symfony2/Twig
body: <p>I'm quite noob when it comes to communicating between js files, controllers, templates and at all when in comes to js and ajax. </p>
  
  <p>I have different links like this:</p>
  
  <pre><code>&lt;a class="details" data-index ={{i}}&gt; Link 1 &lt;/a&gt;
  </code></pre>
  
  <p>but on click they do not load another page, but instead open a mini page, which should have different variable for each link.</p>
  
  <p>I want to do something like this:</p>
  
  <pre><code>$('.details').on('click', function(){
          var index = $(this).data('index');
          {% include 'MyBundle::information.html.twig' with {'var':index} %}
  });
  </code></pre>
  
  <p>but in this way .js won't give the index variable to twig and I get error that index is not defined :( </p>
  
  <p>How to fix this? This don't need to go through controller. Changing the 'var' value does the job.</p>