title: ajax post request handle data in symfony2 controller
body: <p>i really don't understand how to handle with post data from ajax request. This is my javascript:</p>
  
  <pre><code>$.ajax({
       type: "POST",
       url: Routing.generate('save'),
       contentType: 'application/json; charset=UTF-8',
       data: {
            title: title,                
            description: description,
            questions: questions,              
           }
    });
  </code></pre>
  
  <p>The only way to get the data inside my controller action is this:</p>
  
  <pre><code>$content = $request-&gt;getContent()
  </code></pre>
  
  <p>$content is a url parameter string.
  Why don't i get the data normally with:</p>
  
  <pre><code>$request-&gt;get('title')
  </code></pre>
  
  <p>What is the correct way to handle the post data with jquery ajax methd?</p>
  
  <p>Thank you very much.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>So, i found out the following issue:</p>
  
  <p>In my current project the request looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/O0BAg.png" alt="https://dl.dropboxusercontent.com/u/17861060/false.png"></p>
  
  <pre><code>$.ajax({
              type: "POST",
              url: Routing.generate('poll_save'),                
              data: {
                  title: title                    
              }
          })
  </code></pre>
  
  <p>The data is requested via <strong>Request Payload</strong> but i don't know why.</p>
  
  <p>In a clean project the request looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/ShcVI.png" alt="https://dl.dropboxusercontent.com/u/17861060/right.png"></p>
  
  <pre><code>$.ajax({
                  type: "POST",
                  url: '{{path('_demo')}}',                    
                  data: {
                      title: 'title',                
                      description: 'description',
                      questions: 'questions',
                      pollid: 1                        
                  }
              })
  </code></pre>
  
  <p>Anything in my project is going wrong. Do you have an idea why the data is requested via <strong>Request Payload</strong>?</p>