title: How to pass javascript variables values from twig to controller using href path in Symfony2?
body: <p>I would like to know how to pass javascript variables values from twig to controller using href path in Symfony2. this is my code:</p>
  
  <pre><code> &lt;html&gt;
  &lt;head&gt;
      &lt;script src="//code.jquery.com/jquery-1.11.1.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;script&gt;
          var a = "hello";
          var b = "hi";
          var c = $('&lt;a href="{{ path('ikproj_groupe_homepagegroupe1', {'id': a, 'num': b}) }}"&gt;send data&lt;/a&gt;');
          $('body').append(c);
      &lt;/script&gt;    
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The problem is that it displays this message: Variable "a" does not exist .
  So, my question is: what is the correct code to do that?</p>