title: PHP file not found in AJAX call in Twig
body: <p>I am practicing unit test for AJAX call in Symfony 2.8.</p>
  
  <p>Here is my code : </p>
  
  <pre><code>&lt;script&gt;
  QUnit.test("test dynamic fill", function (assert) {
              var ajax = $("#ajax"); //my div to fill
              $("#feed_the_ajax").click(function () {
                  $.ajax({
                      url: "echo.php",
                      type: "POST",
                      data: {text: "Hello world !"},
                      success: function (data) {
                          ajax.text(data);
                      },
                      error: function () {
                      }
                  });
                  assert.ok(!ajax.text() == "Hello world !", "Hello !");
              });
              assert.ok(!ajax.text() == "Hello world !", "Answer me ...");
          });
  &lt;/script&gt;
  </code></pre>
  
  <p>It is located in a twig file.</p>
  
  <p>echo.php file is just like this : </p>
  
  <pre><code>&lt;?php
  if($_POST['text'] != ""){
      return $_POST['text'];
  }
  </code></pre>
  
  <p>When I run the code, it tells me that "echo.php" is not found.</p>
  
  <p>So there is two questions :</p>
  
  <p>1) First, am I doing it wright to call an AJAX like this (in the twig) or should I use the Controller ?</p>
  
  <p>2) Secondly, where should I put my PHP file to avoid 404 error ?</p>
  
  <p>Thanks for your answers,
  Telest</p>
  
  <hr>
  
  <p><strong>EDIT 8/07/16</strong></p>
  
  <p>Greetings,</p>
  
  <p>I am back to share with you my solution.
  I simply use a bundle called FOSJsRoutingBundle, that will generate a route to a function in the controller. 
  Then I "convert" my "echo.php" into a function with a route in my controller, answered a Response and ... Tadaa ! </p>
  
  <p>Solved !</p>
  
  <p>Thanks for your help !
  Regards,</p>