function buscarClasii(b, a){
  const parametros = new FormData();
  parametros.append("txtNom", document.formClasii.txtNom.value);

  $.ajax({
    data:  parametros,
    url:   "busClasii/data.php",
    type:  "post",
    contentType: false,
    processData: false,
    beforeSend: function () {
      alLoad("Consultando...")
    },
    success: function (jsonPhp) {
      const jsonJS = JSON.parse(jsonPhp);

      tblClear("tblClasii");
      jsonJS.clasii.forEach(function(i){
        addRowClasii(i.cla_cod, i.cla_nom);
      });

      $("#tblClasii tbody tr").dblclick(function() {
        selectClasii(a, $(this));
      });

      $("#tblClasii tbody #btnSelecClasii").click(function() {
        selectClasii(a, $(this).parents("tr"));
      });

      alClose();
    }
  });
}

function addRowClasii(cod, nom) {
  const markup =  "<tr>"
                    +"<td>"+cod+"</td>"
                    +"<td>"+nom+"</td>"
                    +"<td><button class='btn btn-sm btn-warning badge' id='btnSelecClasii'>"+textBtnSelec+"</button></td>"
                  +"</tr>";
  $("#tblClasii tbody").append(markup);
}

function selectClasii(a, tr) {
  $("#pills-"+a+"-tab").click();
  /*if (inputProvee == "txtNit") {
    document.thisform.txtNit.value = tr.find("td:eq(0)").text();
    $("form[name='thisform'] #txtNit").trigger("change");
  } else {*/
    $("#"+inputCod).val(tr.find("td:eq(0)").text());
    $("#"+inputCod).trigger("change");
  //}

  //$('html, body').animate( { scrollTop : 0 }, 500 );
  tblClear("tblClasii");
}