ajax
in package
Handles AJAX responses in Jeedom
Tags
Table of Contents
Methods
- error() : never
- Sends an error response and ends execution
- getResponse() : string|false
- Generates formatted JSON response
- getToken() : string
- Returns authentication token
- init() : void
- Initializes AJAX response with HTTP headers and GET action validation
- success() : never
- Sends a success response and ends execution
Methods
error()
Sends an error response and ends execution
public
static error([mixed $_data = '' ][, int $_errorCode = 0 ]) : never
Parameters
- $_data : mixed = ''
-
Error message or data to send
- $_errorCode : int = 0
-
Custom error code for client-side handling (default: 0)
Return values
nevergetResponse()
Generates formatted JSON response
public
static getResponse([mixed $_data = '' ][, int|null $_errorCode = null ]) : string|false
Parameters
- $_data : mixed = ''
-
Data to include in response
- $_errorCode : int|null = null
-
Error code (null for success response)
Return values
string|false —Encoded JSON response
getToken()
Returns authentication token
public
static getToken() : string
Tags
Return values
string —Empty token
init()
Initializes AJAX response with HTTP headers and GET action validation
public
static init([array<string|int, string> $_allowGetAction = array() ]) : void
Parameters
- $_allowGetAction : array<string|int, string> = array()
-
List of allowed GET actions
Tags
success()
Sends a success response and ends execution
public
static success([mixed $_data = '' ]) : never
Parameters
- $_data : mixed = ''
-
Data to send in response