added renderJson

This commit is contained in:
tracer 2022-10-28 17:00:16 +02:00
parent dba37e57f9
commit 24c8a3d9d7
1 changed files with 10 additions and 0 deletions

View File

@ -41,4 +41,14 @@ class Template
}
exit(0);
}
/*
* For AJAX calls, return json
*/
public function renderJson(array $results): never
{
http_response_code(response_code: $results['status']);
echo json_encode(value: $results);
exit(0);
}
}