function remove_playlist($playlistid) { $userid = $this->session->userdata('userid'); $result = array("error" => FALSE); if (!$userid) { $result["error"] = "User must be logged in to access her playlist."; } else { try { if (!Playlist::removePlaylist($playlistid, $userid)) { $result["error"] = TRUE; } } catch (Exception $e) { $result["error"] = $e->getMessage(); } } echo json_encode($result); }