title: How to get Ajax post request by symfony2 Controller
body: <p>I send text message like this   </p>
  
  <p>html markup</p>
  
  <pre><code>&lt;textarea id="request" cols="20" rows="4"&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p>javascript code</p>
  
  <pre><code>var data = {request : $('#request').val()};
  
  $.ajax({
      type: "POST",
      url: "{{ path('acme_member_msgPost') }}",
      data: data,
      success: function (data, dataType) {
          alert(data);
      },
      error: function (XMLHttpRequest, textStatus, errorThrown) {
          alert('Error : ' + errorThrown);
      }
  });
  </code></pre>
  
  <p>symfony2 controller code</p>
  
  <pre><code>$request = $this-&gt;container-&gt;get('request');
  $text = $request-&gt;request-&gt;get('data');
  </code></pre>
  
  <p>but <code>$text</code> is null ...</p>
  
  <p>I have tried normal post request (not Ajax) by firefox http request tester.</p>
  
  <pre><code>/app_dev.php/member/msgPost
  </code></pre>
  
  <p>Controller works and <code>$text</code> has a value.</p>
  
  <p>So I think the php code is OK, there is the problem on Ajax side, however </p>
  
  <p>'success:function' is called as if succeeded.</p>
  
  <p>How can you get the contents of javascript data structure?</p>