noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 58/107: javascript Add new function json_resp


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 58/107: javascript Add new function json_response
Date: Mon, 26 Aug 2019 10:31:58 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 875071214e66b726055b2679b3928898ea582e0b
Author: Dany De Bontridder <address@hidden>
Date:   Tue Jul 30 21:52:49 2019 +0200

    javascript Add new function json_response
---
 include/lib/function_javascript.php | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/lib/function_javascript.php 
b/include/lib/function_javascript.php
index 0db0317..12dbbde 100644
--- a/include/lib/function_javascript.php
+++ b/include/lib/function_javascript.php
@@ -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);
+}
+
 ?>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]