WordPress version for this autocomplete jQuery code

Shouldn’t you add full path of the ajax.php in your code.

If your ajax.php file is in theme folder then you can use get_template_directory_uri() function to define file path. So this should be your code.

$(document).ready(function () {
    var ac_config = {
        source: "<?php echo get_template_directory_uri(); ?>/ajax.php",
        select: function (event, ui) {
            $("#facility_name").val(ui.item.facility_name);
        },
        minLength: 1
    };
    $("#facility_name").autocomplete(ac_config);
});

If your ajax.php file is located somewhere else then use path accordingly.