title: submit a form using ajax in functional test
body: <p>I'm creating a functional test for the inscription part of my project and I need to know how to test it if the form needs to go in an ajax request, otherwise the server will always return an empty inscription form.</p>
  
  <p>Looks like the submit method doesn't take an argument that specifies whether it's an ajax a request unlike request method ->  <a href="http://api.symfony.com/2.3/Symfony/Component/HttpKernel/Client.html#method_submit" rel="nofollow">http://api.symfony.com/2.3/Symfony/Component/HttpKernel/Client.html#method_submit</a></p>
  
  <p>Thanks</p>
  
  <p><strong>UPDATE1</strong></p>
  
  <pre><code>////////////////////////////////////////////////
  // My functional test looks exactly like this //
  ////////////////////////////////////////////////
  $form = $buttonCrawlerNode-&gt;form(array(
      'name'              =&gt; 'Fabien',
      'my_form[subject]'  =&gt; 'Symfony rocks!',
  ));
  // There is no way here I can tell client to submit using ajax!!!!
  $client-&gt;submit($form);
  
  // Why can't we tell client to submit using ajax???
  // Like we do here in the request méthod
  $client-&gt;request(
      'GET',
      '/post/hello-world',
      array(),
      array(),
      array('HTTP_X-Requested-With' =&gt; 'XMLHttpRequest')
  );
  </code></pre>