Hi there,
New to Slim in general, but I’m getting the hang of it. Anyway, I’m sending an ajax post to one of my routes, but the body is turning up null
. I verified the output of the data being sent to the route via ajax and it’s working just fine.
Here’s the ajax request:
$.ajax({
type: 'POST',
url: 'http://localhost:8888/aslists/public/sign-in',
contentType: 'application/octet-stream; charset=utf-8',
data: authResult["code"], // sends a string to the server
success: function(result) {
console.log(result);
},
processData: false
});
For my route file I have:
$app->post('/sign-in', '\Foo\Controllers\LoginController:login');
For the method inside of LoginController
I have:
public function login($request, $response) {
var_dump($request->getParsedBody());
}
I’m not really sure why this is failing. I played around with other content types like text/html
and text/xml
but I still got null