$result = ""; $filters = $_POST['filters']; require_once APPLICATION_PATH . MODEL_DIR . '/Party.php'; $party = new Party(); $result = $party->search($search_term, $filters, $search_type); } } /** * Once a search result has been selected, this gets the rest of the selected user's info */ if (isset($_POST['form']) && $_POST['form'] == "get_party_info") { if (isset($_POST['party_id'])) { require_once APPLICATION_PATH . MODEL_DIR . '/Party.php'; require_once APPLICATION_PATH . MODEL_DIR . '/Ajax.php'; $party_id = $_POST['party_id']; $result = ""; $party = new Party(); $result = $party->preparePartyRecord($party_id); $ajax = new Ajax(); $search_name = $result->party->name; $search_id = $result->party->id; $result->search_history = $ajax->storeSearchResult('party_search_history', $search_id, $search_name); } } if (isset($_POST['form']) && $_POST['form'] == "get_search_history") { require_once APPLICATION_PATH . MODEL_DIR . '/Ajax.php'; $ajax = new Ajax(); $result = $ajax->getSearchHistory($_POST['search_type']); } header('Content-Type: application/json'); echo json_encode(array("result" => $result));