Problems with plugin that fetches data from database with ajax

Well, that just won’t work for so many reasons if this is actually your whole plugin.

I’m guessing you are getting a fatal error here. This is because you are using HTML (and javascript for that matter) in the PHP document.

Also, if the getuser.php is not located at the root of your site, JavaScript won’t find it.

I would also use the jQuery method, as you are already using it.

Try this:

 <?php
/*
Plugin Name: WordPress Plugin Stijn 1
Description: Een WordPress plugin die data uit een database haalt en invult via Ajax in een form.
Version: 1.0
Author: Stijn Aerts
Author URI: Stijn Aerts
License: GPL2
*/

add_action( 'wp_footer', 'ajax_lookup_userdata' );

function ajax_lookup_userdata() {

    $url = plugins_url( 'getuser.php', __FILE__ ); // get the url to the getuser.php-script

    ?>
    <script type="text/javascript">
    jQuery( document ).ready(function($) { // jQuery runs in noConflict mode, use this while developing for WordPress

        $('#input_1_2').change(function() {
            showUser(this.value)
        });

        function showUser(str) {

            if(str == '') {
                $('form').html('');
            }

            $.get(<?php echo $url; ?>, { q: str }, function(response) {
                $('form').html(response);
            });

        }
    });
    </script>
<?php
}
?> 

Also I would look in to using WordPress’ native ajax functions for plugins.