diff options
Diffstat (limited to 'src/post-ajax.php')
| -rw-r--r-- | src/post-ajax.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/post-ajax.php b/src/post-ajax.php new file mode 100644 index 0000000..df5a01a --- /dev/null +++ b/src/post-ajax.php | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | <?php | ||
| 2 | if($_SERVER['REQUEST_METHOD'] === 'POST'){ // && $_SESSION['admin'] === true | ||
| 3 | if($_SERVER['CONTENT_TYPE'] === 'application/json'){ | ||
| 4 | $data = file_get_contents('php://input'); | ||
| 5 | $json = json_decode($data, true); | ||
| 6 | //var_dump($json); | ||
| 7 | |||
| 8 | $id = isset($json['id']) ? $json['id'] : 7; // = id_event en BDD si nouvel évènement | ||
| 9 | echo json_encode(['success' => true, 'id' => $id]); | ||
| 10 | die; | ||
| 11 | } | ||
| 12 | } \ No newline at end of file | ||
