File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
docs/development/legacy/libraries Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -159,12 +159,12 @@ Example:
159159
160160NOTE: ** Note:** Calling this method manually without aborting script execution will result in duplicated output.
161161
162- ### ` send_ajax_response($msg, [$error = false]) `
162+ ### ` send_ajax_response($msg, [$statusCode = false]) `
163163
164164| Parameter | Type | Description |
165165| --------- | -------- | -------------------- |
166166| \$ msg | ` Array ` | Object to be sent to the client. |
167- | \$ error | ` Bool ` | TRUE to set header status to ` 500 ` |
167+ | \$ error | `Bool| Int ` | HTTP status code. If ` false ` , status code is ` 200 ` . If ` true ` , status code is 500 |
168168| Returns | ` Void ` | void |
169169
170170Calling this method encode the given ` $msg ` parameter and will set the header ` Content-Type: application/json ` .
@@ -176,3 +176,22 @@ Example:
176176 'foo' => 'bar'
177177 );
178178 ee()->output->send_ajax_response($output);
179+
180+ With status code (401):
181+
182+ ```
183+ $output = array(
184+ 'sucess' => 'false',
185+ 'message' => 'not allowed',
186+ );
187+ ee()->output->send_ajax_response($output, 401);
188+ ```
189+
190+ As error with standard 500 error code:
191+
192+ ```
193+ $output = array(
194+ 'sucess' => 'false',
195+ 'message' => 'not allowed',
196+ );
197+ ee()->output->send_ajax_response($output, true);
You can’t perform that action at this time.
0 commit comments