If you're trying to post on the same page (which is a bad idea anyway), you should have always have an exit/die; on that PHP catch block, and a success function callback on the $.post.
Example:
Simulated JS:
<?php $adminid = 1; ?>
<a data-toggle="modal" data-id="<?=$adminid;?>" href="#view_contact" class="btn btn-info btn-xs view-admin">View</a>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).on("click", ".view-admin", function () {
    var adminid = $(this).data('id');
    $.post("index.php", {admin_to_pass: adminid}, function(response){
        console.log(response);
    });
});
</script>
Here on the PHP (same page):
if($_SERVER['REQUEST_METHOD'] == 'POST') {
    echo json_encode($_POST['admin_to_pass']);
    exit; // this is important
}
Or
if(isset($_POST['admin_to_pass'])) {
    echo json_encode($_POST['admin_to_pass']);
    exit; // this is important
    // you must have this or you'll catch the whole document
}
And since in your current code you don't have one, you need the success callback function to process the response which came from the server:
$.post("index.php", {admin_to_pass: adminid}, function(response){
                                                    ^^^^
    console.log(response); // your response from the server is inside (you can name it any name you want) 
});