From 7e499647e35a743e0998ed2b722fbaeb81ef96da Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 23 Feb 2019 15:25:41 -0500 Subject: [PATCH] Add System::jsonError method for ajax call returns --- src/Core/System.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Core/System.php b/src/Core/System.php index 69d15a176..45a88fe09 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -176,6 +176,12 @@ class System extends BaseObject exit(); } + public static function jsonError($httpCode, $data, $content_type = 'application/json') + { + header($_SERVER["SERVER_PROTOCOL"] . ' ' . $httpCode); + self::jsonExit($data, $content_type); + } + /** * @brief Encodes content to json. *