- ⌂ ajax
- Methods
ajax::set()
The set
method creates or updates response data values. If no data value is already defined, it will be created and set.
The more common approach is to reference the data value as a property, like
$ajax->property = 'test';
.Prototype
mixed set(string $key, mixed $value)
Parameters
- key - Name of the parameter to retrieve. If NULL or no key is provided, an associative array of all parameters will be returned.
- value - Value to send in the response, which will be converted to JSON. The value may be a string, number, boolean or array of the same, or associative array of the same.
Example
// set the value of the "result"
$ajax = new \io_comand_web\ajax();
$ajax->set('result', 'ok');
$ajax->ok();