case 'changeTicketOwner': $response = BLAM::changeTicketOwner($_POST['id'], $_POST['user_id']); // returns null or exception break; case 'changeTicketDetails': $response = BLAM::changeTicketDetails($_POST['id'], $_POST['title'], $_POST['text'], $_POST['location'], $_POST['handle_id']); // returns null or exception break; case 'createSubTicket': $response = BLAM::createSubTicket($_POST['parent_id'], $_POST['text'], $_POST['location'], $_POST['handle_id']); // returns integer SubTicketId or exception break; case 'becomeChildTicket': $response = BLAM::becomeChildTicket($_POST['id'], $_POST['parent_id']); // returns null or exception break; case 'becomeParentTicket': $response = BLAM::becomeParentTicket($_POST['id']); // returns array users(integer Id, string Role, string Username, integer Totaal) or exception break; case 'createFeedback': $response = BLAM::createFeedback($_POST['ticket_id'], $_POST['text'], $_POST['handle_id']); // returns array users(integer Id, string Role, string Username, integer Totaal) or exception break; default: throw new Exception('Wrong action'); } echo json_encode($response); } catch (Exception $e) { die(json_encode(array('error' => $e->getMessage()))); }