Methods for handling JSON output, usually for AJAX responses
This is the code documentation for the SproutCMS project
Search documentation |
class JsonMethods for handling JSON output, usually for AJAX responses
Extending this class<?php
/**
* New class description goes here
*
* @author Your Name, 2026-09-22
**/
class NewClassName extends Json {
/**
* Sends a JSON message which has the success field set to zero
* and the specified message in the message field.
*
* If $message is an Exception object, the message will be extracted
* and if on the test server, a stacktrace is included as well.
*
* This method halts execution
**/
public function error ($message) {
// Method code goes here
}
/**
* Sends a JSON confirmation response, and then terminates.
*
* The returned data will have the key 'success' => 1 added.
* If no data is provided, the returned JSON will only contain the 'success' key.
*
* This method halts execution
**/
public function confirm ($data) {
// Method code goes here
}
/**
* Outputs the JSON data (encoded) + correct mime type, then stops script execution
**/
public function out (mixed $data, int $options) {
// Method code goes here
}
}
?>
|
| Powered by Pelzini, version 0.9.0 |
Documentation is made available under the
GNU Free Documentation License 1.2. Generated: Tuesday, 15th September, 2026 at 10:26 am |
|