ProcessController::jsonMessage()

Generate a message in JSON format, for use with AJAX output

Usage

// basic usage
$string = $processController->jsonMessage($msg);

// usage with all arguments
$string = $processController->jsonMessage($msg, bool $error = false, bool $allowMarkup = false);

Arguments

NameType(s)Description
$msgstring array

Message string or in 3.0.246+ also accepts an array of extra data When using an array, please include a 'message' index with text about the error or non-error.

$error (optional)bool

Is this in error message? Default is true, or specify false if not.

$allowMarkup (optional)bool

Allow markup in message? Applies only to $msg string or 'message' index of array Default:false

Return value

string

JSON encoded string


ProcessController methods and properties

API reference based on ProcessWire core version 3.0.257