\AJAX

Functions

_json_error()

_json_error(  type) : 

echo JSON error or return if none.

Parameters

type

Returns

decode_jString()

decode_jString(  jsonString) : 

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

Parameters

jsonString

The JSON string

Returns

Array or object

encode_jArray()

encode_jArray(mixed||string|int  jsonArray,   quote = FALSE) : 

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

Parameters

mixed||string|int jsonArray

The unformatted JSON array

quote

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

Returns

The JSON string

jActionForm()

jActionForm(  action, mixed||string|int  jsonArray,   return = FALSE) : 

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

Parameters

action

The javascript action such as 'onclick' etc.

mixed||string|int jsonArray

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

return

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

Returns

jActionIcon()

jActionIcon(  icon,   action, mixed||string|int  jsonArray,   return = FALSE) : 

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

Parameters

icon

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

action

The javascript action such as 'onclick' etc.

mixed||string|int jsonArray

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

return

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

Returns

The image tag

loadJavascript()

loadJavascript(  scripts = FALSE) : 

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

Parameters

scripts

Either an array of .js scripts to load or a single string. It can be FALSE.

Returns