30 lines
682 B
PHP
30 lines
682 B
PHP
<?php
|
|
include 'functions/functions.php';
|
|
|
|
if (isset($_POST['ajax_id'])) {
|
|
switch ($_POST['ajax_id']) {
|
|
case 'todo':
|
|
handle_todo();
|
|
break;
|
|
}
|
|
} else
|
|
echo 'Received malformed request.';
|
|
|
|
function handle_todo()
|
|
{
|
|
$response = [];
|
|
|
|
include 'functions/todo_functions.php';
|
|
|
|
if (isset($_POST['todo_id']) && isset($_POST['action_id']) && isset($_POST['status'])) {
|
|
switch ($_POST['action_id']) {
|
|
case 'status':
|
|
$response['todo_status'] = $_POST['status'];
|
|
change_status($_POST['todo_id'], $_POST['status']);
|
|
break;
|
|
}
|
|
}
|
|
|
|
echo json_encode($response);
|
|
}
|