In a site, I have the following function in Javascript
to bring me into a table the result of a query SQL
.
function buscaBoletos(){
$.ajax({
async: false, cache: false,
url: '[:raiz]emissaoBoletos/getBoletos',
data: ({
unidade: $('#comboUnidades').val(),
de: $('#txtData1').val(),
ate: $('#txtData2').val()
}),
dataType: 'json',
success: function(data) {
$('#divBoletosLista').hide();
var retorno = "";
if (data.length > 0){
for(var i = 0;i< data.length;i++){
retorno += "<tr>";
retorno += "<td style='text-align:left; width:300px'>"+data[i]['razaosocial']+"</td>";
retorno += "<td style='width: 100px'>"+data[i]['nossonumero']+"</td>";
retorno += "<td style='width: 80px'>"+data[i]['status']+"</td>";
retorno += "<td style='width: 80px'>"+data[i]['valor']+"</td>";
retorno += "<td style='width: 100px'>"+data[i]['dataemissao']+"</td>";
retorno += "<td style='width: 100px'>"+data[i]['datavencimento']+"</td>";
retorno += "<td><input class='botaoCad' type='button' value='Visualizar' style='float:none' onclick='verBoleto()'></td>";
retorno += "</tr>";
}
} else {
retorno = "<tr><td colspan='7' align='center'>"+$('#lblSemRegistros').val()+"</td></tr>";
}
$('#bodyBoletosLista').html(retorno);
$('#divBoletosLista').show();
$('#divTelaBoleto').hide();
}
});}
As next, I would like to be able to click on the button that is generated in the last column of the line (from the verBoleto()
function) and thus fill in a ticket (in table format) with the data of the respective line. / p>
How do I do this?