I try to make an Ajax Post Request to a controller in my Project. I made a var_dump() of the $request and it shows me the full Request object including my sent data. If I try to access the data or make var_dump($request->request); (For the POST-Data) I get a Internal Server Error 500. I can't figure out what I'm doing wrong.
View:
$.ajax({
type: "post",
url: "/symfony/web/app_dev.php/setliste/{{entity.id}}/update",
data: { dataArray : dataArray },
error: function(x, status, error) {
alert(status+error);
console.log(x);
}
}).done(function(msg){
console.log(msg);
});
Controller:
public function updateAction(Request $request, $id) {
$test = $request;
var_dump($test);
}
Alex
A controller action must have a return statement which contains a Response.
To solve this problem, change your code to :
public function updateAction(Request $request, $id) {
$test = $request;
return new \Symfony\Component\HttpFoundation\Response(var_dump($test));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With