javascript Add new function json_response

This commit is contained in:
Dany De Bontridder 2019-07-30 21:52:49 +02:00
parent 3b22021fd6
commit 875071214e

View file

@ -2784,4 +2784,16 @@ function load_all_script()
}
/**
* Send header and json object
* @param array $p_answer this array will be converted to json object
* @see json_encode
*/
function json_response($p_answer)
{
header("Content-type: text/json; charset: utf8", true);
echo json_encode($p_answer,
JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK);
}
?>