Fix: send request / receive json data
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
function send_error_code($error_code) {
|
||||
$returnValue = array(
|
||||
'error' => $error_code
|
||||
);
|
||||
echo json_encode($returnValue, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
$jsonReply = null;
|
||||
|
||||
function set_error_message($message) {
|
||||
global $jsonReply;
|
||||
|
||||
$jsonReply["error"] = $message;
|
||||
}
|
||||
|
||||
function set_data($name, $data) {
|
||||
global $jsonReply;
|
||||
|
||||
$jsonReply[$name] = $data;
|
||||
}
|
||||
|
||||
function send_result_success() {
|
||||
global $jsonReply;
|
||||
global $db_conn;
|
||||
|
||||
$jsonReply["result"] = "success";
|
||||
echo json_encode($jsonReply, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
}
|
||||
|
||||
function send_result_fail() {
|
||||
global $jsonReply;
|
||||
global $db_conn;
|
||||
|
||||
$jsonReply["result"] = "fail";
|
||||
echo json_encode($jsonReply, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user