]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | <?php\r |
2 | \r | |
3 | include '../connection.php';\r | |
4 | \r | |
5 | try {\r | |
6 | $params = json_decode(file_get_contents('php://input'));\r | |
7 | \r | |
8 | $statement = $db->prepare("delete from task where id = $params->id");\r | |
9 | \r | |
10 | if(!$statement->execute()) {\r | |
11 | throw new Exception(implode(', ', $statement->errorInfo()));\r | |
12 | }\r | |
13 | $jsonResult = array('success' => true);\r | |
14 | } catch(Exception $e) {\r | |
15 | $jsonResult = array(\r | |
16 | 'success' => false,\r | |
17 | 'message' => $e->getMessage()\r | |
18 | );\r | |
19 | }\r | |
20 | \r | |
21 | echo json_encode($jsonResult);\r | |
22 | \r | |
23 | ?> |