Joomla-Ajax-Interface/component

Return HTTP Error Code with custom message?

Opened this issue · 0 comments

How can I return error code using this plugin?

I did like this but it doesn't work exactly.

http_response_code(401);
return json_encode(array(
'message' => 'error message'
));

On cilentside i am able to get 401 error code but i can't get the error message.
I get {"success":true,"message":null,"messages":null,"data":null} or empty.

I would like to have a response similar to this
{"success":true,"message":null,"messages":null,"data":{
'message' => 'error message'
}}.