Skip to content

Commit f907b58

Browse files
RK311yintoeetive
authored andcommitted
Add documentation for send_ajax_response
1 parent 5946f37 commit f907b58

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/development/legacy/libraries/output.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,21 @@ Example:
158158
exit;
159159

160160
NOTE: **Note:** Calling this method manually without aborting script execution will result in duplicated output.
161+
162+
### `send_ajax_response($msg, [$error = false])`
163+
164+
| Parameter | Type | Description |
165+
| --------- | -------- | -------------------- |
166+
| \$msg | `Array` | Object to be sent to the client. |
167+
| \$error | `Bool` | TRUE to set header status to `500` |
168+
| Returns | `Void` | void |
169+
170+
Calling this method encode the given `$msg` parameter and will set the header `Content-Type: application/json`.
171+
172+
Example:
173+
174+
$output = array(
175+
'this' => 'that',
176+
'foo' => 'bar'
177+
);
178+
ee()->output->send_ajax_response($output);

0 commit comments

Comments
 (0)