title: Symfony2 Ajax and Jquery
body: <p>I am developing an application using Symfony2 and twig for the templates. I am also using ajax. This is part of my code in my controller:</p>
  
  <pre><code>    public function testuaanotatuAction(Request $request)
      { 
        if ($request-&gt;isXmlHttpRequest())
        {
         return $this-&gt;forward('AnotatzaileaAnotatzaileaBundle:Page:Interpretatu');
        }
  
      // Some code.....
              return $this-&gt;render('AnotatzaileaAnotatzaileaBundle:Page:AnotatuInterpretazio.html.twig',
                                     array('Azpimarratu' =&gt; $Markagarria-&gt;getMarkIdent()));
  
  }
  
  
      public function InterpretatuAction()
      {
        return $this-&gt;render('AnotatzaileaAnotatzaileaBundle:Page:FAQ.html.twig');
      }
  </code></pre>
  
  <p>And then this is my code in AnotatuInterpretazio.html.twig' were I do the Ajax call using JQuery:</p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
            $("#ButtonId").click(function () 
                               {
                                 $.ajax({
                                          url: "{{ path('AnotatzaileaAnotatzaileaBundle_testuaanotatu') }}",
                                          type: "POST"
                                         });      
                           });
      &lt;/script&gt;
  </code></pre>
  
  <p>As you can see what I intend to do here is to call InterpretatuAction through the template AnotatuInterpretazio.html.twig. Then InterpretatuAction will call another template. It doesnt work, any idea?</p>