title: How to generate Symfony 2 twig URL with parameter value from Javascript?
body: <p>I want to append query string parameters from javascript (jquery) to symfony 2 url. 
  I want to pass the value of selected radio button to ajax request e.g.in plain php I would have done like</p>
  
  <pre><code>$(document).ready(function() {
      $('.id_radio').click(function() {                      
          $.ajax({
              'url': 'example.php?id='+($this).val(),
              'success': function(r) {
                  $('#div1').html(r);
              }
          });
      });
  </code></pre>
  
  <p>How to generate such URL in symfony2 twig ? We generate URL in symfony 2 twig like </p>
  
  <p><code>{{ path('example_path', {'id': id}) }}</code> where id is twig variable. </p>
  
  <p>I tried using FOSJsRoutingBundle but don't know if it is for same problem and not sure how to use it ?</p>
  
  <p>I tried below but it is not working. </p>
  
  <pre><code>$('.id_radio').click(function() {
      alert(Routing.generate('example_path', {
          'id': $(this).val()
          }));
      $.ajax({
          'url': Routing.generate('example_path', {
              'id': $(this).val()
              }),
          'success': function(r) {
              $('#div1').html(r);
          }
      });
  });
  </code></pre>
  
  <p>Solution mentioned below by koskoz worked, I did not pass options={"expose"=true} but after adding it worked. </p>
  
  <p>But there is one more problem. It works only until we do not refresh page. If we refresh page, it does not work. To make it work, I have to delete symfony cache files. </p>
  
  <p>It does not work in other browser if we have already opened it in one browser. </p>