* Results are formatted and put in $result
 * which is then json encoded and returned as a json file response
 */
$result = new stdClass();
/**
 * Process the search request
 */
if (isset($_POST['form']) && $_POST['form'] == "search") {
    if (isset($_POST['search_term']) && isset($_POST['search_type'])) {
        $search_term = $_POST['search_term'];
        $search_type = $_POST['search_type'];
        $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;