ajax start ob and dump if debug
This commit is contained in:
parent
90b6795f65
commit
3d28060afc
1 changed files with 9 additions and 1 deletions
|
@ -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');
|
||||
|
|
Loading…
Add table
Reference in a new issue