$(document).ready(function () {
    $("body").on("change", '.flatno', getName);

    function getName() {
        var flatno = $('.flatno').val()

        if (flatno != '') {
            $.post('get_flatname.php', {flatno: flatno}, function (data) {
                $("#party").val(data.accode);
                $("#party").trigger('change');

            }, 'json');
        }

    }

});