ajax start ob and dump if debug

This commit is contained in:
Miroslav Šedivý 2019-12-23 20:27:21 +01:00
parent 90b6795f65
commit 3d28060afc

View file

@ -5,6 +5,10 @@ class Ajax
{
private $_response = null;
public function __construct(){
ob_start();
}
public function set_error($msg = null){
$this->_response = [
"error" => true,
@ -36,7 +40,11 @@ class Ajax
public function json_response(){
if(ob_get_length() > 0) {
ob_clean();
if(Config::get_safe('debug', false)){
$this->_response["debug"] = ob_get_clean();
} else {
ob_clean();
}
}
header('Content-Type: application/json');