class 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.

Properties

boolean $success Determines whether the request was successful
string $message The main response message
array $messages Array of messages gathered in the \JApplication object
mixed $data The response data

Methods

__construct( mixed $response = null, string $message = null, boolean $error = false, boolean $ignoreMessages = false)

Constructor

string
__toString()

Magic toString method for sending the response in JSON format

Details

__construct( mixed $response = null, string $message = null, boolean $error = false, boolean $ignoreMessages = false)

Constructor

Parameters

mixed $response The Response data
string $message The main response message
boolean $error True, if the success flag shall be set to false, defaults to false
boolean $ignoreMessages True, if the message queue shouldn't be included, defaults to false

string __toString()

Magic toString method for sending the response in JSON format

Return Value

string The response in JSON format