AJAX在一个输入端被阻止

I need to do for my customer a invoice using jQuery and AJAX. All good, I created an algorithm which autocomplete price, quantity and total. An AJAX call is made when first letter of product is entered in name input and suggestion is showed bottom of input. When I need to add a product, jQuery removes class "active" from inputs and creates another row with class "active". The problem is when I try to complete second or third or... input. AJAX is remaining blocked at first one which don't have "active" class. When i try to input some name in second input form it doesn't work only if i hit enter in the first input form and shows results in the second input form from first one. Bottom is the code:

HTML: <tr align='center'>
                <td>1</td>
                <td><input type='text' class='name active' name='product'><br/> <input type='text' class='name_finded active' name='product[]' readonly></td>
                <td>Buc</td>
                <td ><input type='text' class='cantitate active'></td>
                <td ><input type='text' readonly value='0' class='pret_unitar active' readonly></td>
                <td class='pret_3x4 active'></td>
                <td class='val_tva active'></td>
            </tr>
JS:
$('.name.active').on('input',function(){ 
        var query = $('.name.active').val();
        if(query != ''){
            $.ajax({
                url: 'get_product_data.php',
                method: 'POST',
                data:{query:query},
                dataType: "json",
                success:function(data){
                    var nume = data['nume'];
                    var pret = data['pret'];
                    pret_ftva = pret-(pret*0.19);
                    $(".pret_unitar.active").val(pret_ftva);
                    $(".name_finded.active").val(nume);
                }
            });
        }

});
PHP:
    require "../config.php";


    $conn = new mysqli($sv, $us, $pa, $db);

    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    $value = mysqli_real_escape_string($conn, $_POST['query']);

    $sql = "SELECT * FROM clienti WHERE nume LIKE '%$value%'";

    $result = $conn->query($sql);

    if ($result->num_rows > 0) {
        // output data of each row
        $row = mysqli_fetch_array($result);
        $nume = $row['nume'];
        $cui = $row['cui'];
        $orc = $row['orc'];
        $localitate = $row['localitate'];
        $adresa = $row['adresa'];
        $iban = $row['iban'];
        $banca = $row['banca'];
        $reprezentant = $row['reprezentant'];
        $ci = $row['ci'];
        $telefon = $row['telefon'];
        $mail = $row['mail'];

        $arr = array("nume"=>$nume, "cui"=>$cui, "orc"=>$orc, "localitate"=>$localitate, "adresa"=>$adresa, "iban"=>$iban, "banca"=>$banca, "reprezentant"=>$reprezentant, "ci"=>$ci, "telefon"=>$telefon, "mail"=>$mail);
        echo json_encode($arr);
    }
    $conn->close();