WIKINDX API 6.10.2

AJAX

Table of Contents

Functions

loadJavascript()  : void
Load the ajax javascript and the user javascript(s) into the HTML page output.
jActionForm()  : string
Create and load the HTML form element insert for the AJAX action and function.
jActionIcon()  : string
Create and load the IMG element insert for the AJAX action and function. Works with core/libs/LOADICONS.php.
encode_jArray()  : string
Convert $jsonArray to JSON string and format any array elements referencing javascript functions.
decode_jString()  : mixed
Convert JSON-formatted $jsonString to an array or object.
_json_error()  : void
echo JSON error or return if none.

Functions

loadJavascript()

Load the ajax javascript and the user javascript(s) into the HTML page output.

loadJavascript([mixed $scripts = [] ]) : void
Parameters
$scripts : mixed = []

Either an array of .js scripts to load or a single string.

jActionForm()

Create and load the HTML form element insert for the AJAX action and function.

jActionForm(string $action, array<string|int, mixed> $jsonArray[, bool $return = FALSE ]) : string
Parameters
$action : string

The javascript action such as 'onclick' etc.

$jsonArray : array<string|int, mixed>

The parameter to be passed to gateway() as an array ready to be converted to JSON

$return : bool = FALSE

If TRUE, generated javascript has a return from the gateway() function. Default is FALSE.

Return values
string

jActionIcon()

Create and load the IMG element insert for the AJAX action and function. Works with core/libs/LOADICONS.php.

jActionIcon(string $icon, string $action, array<string|int, mixed> $jsonArray[, bool $return = FALSE ]) : string
Parameters
$icon : string

The icon to make an image of ('add', 'delete', 'view' etc.)

$action : string

The javascript action such as 'onclick' etc.

$jsonArray : array<string|int, mixed>

The parameter to be passed to gateway() as an array ready to be converted to JSON

$return : bool = FALSE

If TRUE, generated javascript has a return from the gateway() function. Default is FALSE.

Return values
string

The image tag

encode_jArray()

Convert $jsonArray to JSON string and format any array elements referencing javascript functions.

encode_jArray(array<string|int, mixed> $jsonArray[, bool $quote = FALSE ]) : string
Parameters
$jsonArray : array<string|int, mixed>

The unformatted JSON array

$quote : bool = FALSE

No encoding of quotation marks (") if set to FALSE. Default is FALSE.

Return values
string

The JSON string

decode_jString()

Convert JSON-formatted $jsonString to an array or object.

decode_jString(string $jsonString) : mixed
Parameters
$jsonString : string

The JSON string

Return values
mixed

Array or object

_json_error()

echo JSON error or return if none.

_json_error(string $type) : void
Parameters
$type : string

        
On this page

Search results