getID() == 0 ) pushData("No task found"); $data["message"] = "Listing Task ID={$task->getID()}"; $data["task"] = $task; pushData(); exit(); function pushData($errormsg = null) { global $data; if ( !is_null($errormsg) ) { $data["error"] = true; $data["message"] = $errormsg; } header('Content-Type: application/json'); echo json_encode($data); exit(); }