title: Symfony 3 Form Ajax Post Request Data is Empty
body: <p>I show a list of tags to which I have a little form to add another to that list.</p>
  
  <p>I am completing this form with ajax rather than with symphony doctrine as I want to add something to a list dynamically rather than having a page request.</p>
  
  <p>The HTML code below shows how I have created a form:</p>
  
  <pre><code>            &lt;div class="tag-form"&gt;
                  &lt;form id="tag-form" name="tagging-form" action="{{path('media_bulk_tag_route') }}" method="post"&gt;
                  &lt;input placeholder="Enter Tag" class="add-tag-input"&gt;
                  &lt;button type="submit"&gt;Add&lt;/button&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p>I then submit this form with Jquery ajax: </p>
  
  <pre><code>$('#tag-form').on('submit',function(e){
                      e.preventDefault();
                      var data = $('form[name="tagging-form"]').serialize();
                      $.ajax({
                          type: 'POST',
                          url: $(this).attr('action'),
                          data: {request: data},
                          success: function (resp) {
                              var d = $.parseJSON(JSON.stringify(resp));
                              console.log(d);
                          },
                          complete: function () {
  
                          }
                      })
  
                  });
  </code></pre>
  
  <p>In my controller I am getting this request and just var dumping it.</p>
  
  <pre><code>/**
   * Bulk tagging
   *
   * @Route("/media-tagging", name="media_bulk_tag_route")
   */
  public function mediaBulkTag(Request $request)
  {
      $request-&gt;request-&gt;get('request');
      VarDumper::dump($request);
      die();
  }
  </code></pre>
  
  <p>Now the problem is when I read this var dump in the network console, the data is empty. Why could this be and what more do I have to do. Thanks.</p>
  
  <p>Here is the full dump:</p>
  
  <pre><code>DatabaseController.php on line 125:
  Request {#9
    +attributes: ParameterBag {#12
      #parameters: array:3 [
        "_controller" =&gt; "MyBundle\Controller\DatabaseController::mediaBulkTag"
        "_route" =&gt; "media_bulk_tag_route"
        "_route_params" =&gt; []
      ]
    }
    +request: ParameterBag {#10
      #parameters: array:1 [
        "request" =&gt; ""
      ]
    }
    +query: ParameterBag {#11
      #parameters: []
    }
    +server: ServerBag {#15
      #parameters: array:36 [
        "USER" =&gt; "vagrant"
        "HOME" =&gt; "/home/vagrant"
        "HTTP_COOKIE" =&gt; "Phpstorm-5751b086=1fbc46ec-4192-42ec-8d23-628b66cfe7b4; adminer_version=0; PHPSESSID=hmethpqn6bsq493vpuejbg4ulm"
        "HTTP_ACCEPT_LANGUAGE" =&gt; "en-GB,en-US;q=0.8,en;q=0.6"
        "HTTP_ACCEPT_ENCODING" =&gt; "gzip, deflate, br"
        "HTTP_REFERER" =&gt; "http://localhost:8000/media-database"
        "HTTP_X_REQUESTED_WITH" =&gt; "XMLHttpRequest"
        "HTTP_ACCEPT" =&gt; "*/*"
        "HTTP_CONTENT_TYPE" =&gt; "application/x-www-form-urlencoded; charset=UTF-8"
        "HTTP_USER_AGENT" =&gt; "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
        "HTTP_ORIGIN" =&gt; "http://localhost:8000"
        "HTTP_CONTENT_LENGTH" =&gt; "8"
        "HTTP_CONNECTION" =&gt; "keep-alive"
        "HTTP_HOST" =&gt; "localhost:8000"
        "REDIRECT_STATUS" =&gt; "200"
        "SERVER_NAME" =&gt; "my.bundle"
        "SERVER_PORT" =&gt; "80"
        "SERVER_ADDR" =&gt; "10.0.2.15"
        "REMOTE_PORT" =&gt; "55895"
        "REMOTE_ADDR" =&gt; "10.0.2.2"
        "SERVER_SOFTWARE" =&gt; "nginx/1.11.9"
        "GATEWAY_INTERFACE" =&gt; "CGI/1.1"
        "SERVER_PROTOCOL" =&gt; "HTTP/1.1"
        "DOCUMENT_ROOT" =&gt; "/home/vagrant/Code/my-bundle/web"
        "DOCUMENT_URI" =&gt; "/app_dev.php"
        "REQUEST_URI" =&gt; "/media-tagging"
        "SCRIPT_NAME" =&gt; "/app_dev.php"
        "SCRIPT_FILENAME" =&gt; "/home/vagrant/Code/my-bundle/web/app_dev.php"
        "CONTENT_LENGTH" =&gt; "8"
        "CONTENT_TYPE" =&gt; "application/x-www-form-urlencoded; charset=UTF-8"
        "REQUEST_METHOD" =&gt; "POST"
        "QUERY_STRING" =&gt; ""
        "FCGI_ROLE" =&gt; "RESPONDER"
        "PHP_SELF" =&gt; "/app_dev.php"
        "REQUEST_TIME_FLOAT" =&gt; 1496303912.2553
        "REQUEST_TIME" =&gt; 1496303912
      ]
    }
    +files: FileBag {#14
      #parameters: []
    }
    +cookies: ParameterBag {#13
      #parameters: array:3 [
        "Phpstorm-5751b086" =&gt; "1fbc46ec-4192-42ec-8d23-628b66cfe7b4"
        "adminer_version" =&gt; "0"
        "PHPSESSID" =&gt; "hmethpqn6bsq493vpuejbg4ulm"
      ]
    }
    +headers: HeaderBag {#16
      #headers: array:13 [
        "cookie" =&gt; array:1 [
          0 =&gt; "Phpstorm-5751b086=1fbc46ec-4192-42ec-8d23-628b66cfe7b4; adminer_version=0; PHPSESSID=hmethpqn6bsq493vpuejbg4ulm"
        ]
        "accept-language" =&gt; array:1 [
          0 =&gt; "en-GB,en-US;q=0.8,en;q=0.6"
        ]
        "accept-encoding" =&gt; array:1 [
          0 =&gt; "gzip, deflate, br"
        ]
        "referer" =&gt; array:1 [
          0 =&gt; "http://localhost:8000/media-database"
        ]
        "x-requested-with" =&gt; array:1 [
          0 =&gt; "XMLHttpRequest"
        ]
        "accept" =&gt; array:1 [
          0 =&gt; "*/*"
        ]
        "content-type" =&gt; array:1 [
          0 =&gt; "application/x-www-form-urlencoded; charset=UTF-8"
        ]
        "user-agent" =&gt; array:1 [
          0 =&gt; "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
        ]
        "origin" =&gt; array:1 [
          0 =&gt; "http://localhost:8000"
        ]
        "content-length" =&gt; array:1 [
          0 =&gt; "8"
        ]
        "connection" =&gt; array:1 [
          0 =&gt; "keep-alive"
        ]
        "host" =&gt; array:1 [
          0 =&gt; "localhost:8000"
        ]
        "x-php-ob-level" =&gt; array:1 [
          0 =&gt; 1
        ]
      ]
      #cacheControl: []
    }
    #content: null
    #languages: null
    #charsets: null
    #encodings: null
    #acceptableContentTypes: null
    #pathInfo: "/media-tagging"
    #requestUri: "/media-tagging"
    #baseUrl: ""
    #basePath: null
    #method: "POST"
    #format: null
    #session: Session {#176
      #storage: NativeSessionStorage {#175
        #bags: array:2 [
          "attributes" =&gt; AttributeBag {#171
            -name: "attributes"
            -storageKey: "_sf2_attributes"
            #attributes: &amp; array:1 [
              "_csrf/form" =&gt; "177Yjq_CGVSRLnuBjNTVcsQ3a5Tgzi5-lC8DQDpcE9g"
            ]
          }
          "flashes" =&gt; FlashBag {#170
            -name: "flashes"
            -flashes: &amp; []
            -storageKey: "_sf2_flashes"
          }
        ]
        #started: true
        #closed: false
        #saveHandler: SessionHandlerProxy {#172
          #handler: NativeFileSessionHandler {#174}
          #wrapper: true
          #saveHandlerName: "files"
        }
        #metadataBag: MetadataBag {#173
          -name: "__metadata"
          -storageKey: "_sf2_meta"
          #meta: &amp; array:3 [
            "u" =&gt; 1496303912
            "c" =&gt; 1496303203
            "l" =&gt; "0"
          ]
          -lastUsed: 1496303903
          -updateThreshold: "0"
        }
      }
      -flashName: "flashes"
      -attributeName: "attributes"
    }
    #locale: null
    #defaultLocale: "en"
    -isForwardedValid: true
  }
  </code></pre>