JsonResponse

JSON Response class.

This class serves to provide the Joomla Platform with a common interface to access response variables for e.g. Ajax requests.

since

3.1

package

Joomla CMS

Methods

__construct

Constructor

__construct( response = null,  message = null,  error = false,  ignoreMessages = false) : 
since

3.1

Arguments

response

mixedThe Response data

message

stringThe main response message

error

boolTrue, if the success flag shall be set to false, defaults to false

ignoreMessages

boolTrue, if the message queue shouldn't be included, defaults to false

Response

mixed

__toString

Magic toString method for sending the response in JSON format

__toString() : 
since

3.1

Response

stringThe response in JSON format

Properties

success

Determines whether the request was successful

since

3.1

Type(s)

bool

message

The main response message

since

3.1

Type(s)

string

messages

Array of messages gathered in the Application object

since

3.1

Type(s)

array<string|int, mixed>

data

The response data

since

3.1

Type(s)

mixed