Auto-Fill asynchronously by custom API action and client script not working

Thank you very much for your kind help.the code works in this way too:

$("#ew-modal-dialog #x_codice").on("change", function() {
    console.log("Evento change generato");
    var codice = $(this).val();
    $.get(ew.getApiUrl(["getInfoImpianto", codice]), function(res) {
        if (res) {
            $("#ew-modal-dialog #x_c_commerciale").val(res.Agente);
            $("#ew-modal-dialog #x_c_manutentore").val(res.ManutContr);
        }
    });
});
$("#ew-modal-dialog #x_c_commerciale").prop("disabled", true);
$("#ew-modal-dialog #x_c_manutentore").prop("disabled", true);

Thanks again for your help!!