// if the request fails
        error: function( xhr, status, errorThrown ) {
            alert( "Sorry, there was a problem adding your interest! Please try again in a few moments." );
            console.log( "Error: " + errorThrown );
            console.log( "Status: " + status );
            console.dir( xhr );
        },
    });
});

//remove interest form
$(".remove_interest").submit(function(event) {

    //get interest id
    <?php 
$interest = EventInterestQuery::create()->filterByInterestedUserId($_SESSION['uid'])->filterByTargetEventId($event_id)->find();
$i_id = $interest->getEventInterestId();
?>
    i_id = <?php 
echo $i_id;
?>


    $.post("../interest/remove_interest.php", { event_interest_id : i_id },
        function(data) { $("td[interestid='"+i_id+"']").remove(); },
        "text");

        }
});
    </script>
    </div>
require_once '../database_access.php';
$ei = new EventInterest();
if (isset($_POST['interested_user_id'])) {
    $ei->setInterestedUserId($_POST['interested_user_id']);
}
if (isset($_POST['target_event_id'])) {
    $ei->setTargetEventId($_POST['target_event_id']);
}
if (isset($_POST['bringing_car'])) {
    $ei->setBringingCar($_POST['bringing_car']);
}
if (!$ei->validate()) {
    foreach ($ei->getValidationFailures() as $failure) {
        echo '<p><strong>Error in ' . $failure->getPropertyPath() . ' field!</strong> ' . $failure->getMessage() . '</p>';
    }
    unset($failure);
} else {
    //Check to see if this interest is already here.
    $eq = EventInterestQuery::create()->filterByInterestedUserId($_POST['interested_user_id'])->filterByTargetEventId($_POST['target_event_id'])->count();
    if ($eq != 0) {
        echo '{ "extant": 1 }';
    } else {
        $ei->save();
        // add the author name and return the JSON
        $ei_json = json_decode($ei->toJSON());
        $author = $ei->getInterested();
        $ei_json->authorFirstName = $author->getFirstName();
        $ei_json->authorLastName = $author->getLastName();
        echo json_encode($ei_json);
    }
}
<?php

require_once '../database_access.php';
$ei = new EventInterestQuery();
if (isset($_GET['event_id'])) {
    $event = EventQuery::create()->findPk($_GET['event_id']);
    if ($event) {
        $ei->filterByTarget_Event($event);
    } else {
        // TODO: throw error instead of blank page
        echo "<p>tried to filter by nonexistent event</p>";
    }
}
$ei->join('EventInterest.Interested');
$ei->withColumn('Interested.FirstName', 'authorFirstName');
$ei->withColumn('Interested.LastName', 'authorLastName');
echo $ei->find()->toJson();