How to get Ajax post request by symfony2 Controller
First, you don't need to access the container in your controller as it already implements ContainerAware
So basically your code should look like this in your Controller.php
public function ajaxAction(Request $request){ $data = $request->request->get('request');}
Also, make sure by the data you are sending is not null by using console.log(data)
in the JS of your application.
And finally the answer of your question : you are not using the right variable, you need to access the value of $('#request').val()
but you stored it in a request
variable and you used a data
variable name in your controller.
Consider changing the name of the variable, because it's confusing.