When I'm doing a request into API that I've written using Symfony 2.5. I'm sending form data using POST method and in the controller I'm doing
$params = json_decode($request->getContent(), true);
and if I do
var_dump($params);
I can see everything in console If I'm doing
console.log(data)
But If I try just do something like this:
array_keys($params)
Server returns me a 500 status code and error:
XMLHttpRequest cannot load http://host.loc/app_dev.php/posts. Invalid HTTP status code 500
You will always get 500 Error if something went completely wrong.
e.g. even use dump() in twig - which is not allowed in production
1) try the same page in /app_dev.php/[page] - enable debug, this should give you alot of info about the error
2) look at the correct log file /app/logs/ as mentioned above
I guess you calling getContent() on a null Object ;-)