title: How to create a confirm box with Twig and Symfony2 to redirect the user to page
body: <p>When pushing a delete button, i'd like an alert to pop up to make sure the user didn't make any mistake.</p>
  
  <p>So, In codeIgniter I had this that worked well:</p>
  
  <p>Button:</p>
  
  <pre><code>&lt;td&gt;&lt;a class='Right btn btn-danger' onClick="ConfirmMessage('news', &lt;?php echo $new-&gt;id ?&gt;,'news')"&gt;
                          &lt;i class="icon-remove-sign icon-white"&gt;&lt;/i&gt;
                      &lt;/a&gt;&lt;/td&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>function ConfirmMessage(type, id, types) {
      if (confirm("Are you sure you want to delete this "+type+" ?")) { // Clic sur OK
       document.location.href='&lt;?php echo site_url(); ?&gt;/'+types+'/delete/'+id;
      }
    }
  </code></pre>
  
  <p>But now, with Symfony2, I can't do this:</p>
  
  <p>Button</p>
  
  <pre><code>&lt;td&gt;&lt;a class='Right btn btn-danger' onClick="ConfirmMessage('artist', {{ artist.id }},'news')"&gt;
                              &lt;i class="icon-remove-sign icon-white"&gt;&lt;/i&gt;
                          &lt;/a&gt;&lt;/td&gt;
  </code></pre>
  
  <p>Javascript</p>
  
  <pre><code>function ConfirmMessage(type, id, types) {
      if (confirm("Are you sure you want to delete this "+type+" ?")) { // Clic OK
          document.location.href="{{ path('ymtest_Delete'"+types+", {'id': "+id+"}) }}";
      }
  }
  </code></pre>
  
  <p>Since I get an error when Symfony wants to generate a url.</p>
  
  <p>What could be a solution ?
  Thanks</p>