Retrieve data from wordpress db via input and put those result in dropdown

In the below code when you press button with the id findschoolname ajax will run. you can change the click event with on change of text box.
the below script run ajax.

<div class="col-xs-4">
      <div class="zipcode">Zip Codes
         <input type="text" class="form-control postcode" name="postalCode" />
         <input type="button" id="findschoolname">
       </div>
       <div id="replacedropwdown"> 

       </div>
</div>
<script type="text/javascript">
jQuery(document).ready(function(){
    jQuery("#findschoolname").click(function(){
        var postcode = jQuery('.postcode').val();
        var postData = {
            action: 'finescroolname',
            postcode: postcode,
        }
        var adminurl = admin_url( 'admin-ajax.php' );
        jQuery.post(ajaxurl, postData, function(response) {
            jQuery('#replacedropwdown').html(response);
        });
    }); 
});
</script>

Put the below code in function.php:

add_action( 'wp_ajax_finescroolname', 'finescroolname' );
function finescroolname(){    
    global $wpdb; 
    $postcode = intval( $_POST['postcode'] );

    $school_query = "SELECT DISTINCT schoolname from wp_db where zipcode=".$postcode."";
    $results = $wpdb->get_results($school_query);
    // Create html here and echo it;
    $html="drop down html";
    echo $html;
    wp_die(); 
}

Hope it will help a little.