1
Good morning, after the code that fills the table, click handling does not work on firefox, but works on Chrome, someone has some light, please?
function carregarItens(){
//variáveis
var itens = "", url = "transfer.php";
//Capturar Dados Usando Método AJAX do jQuery
$.ajax({
url: url,
cache: false,
dataType: "json",
beforeSend: function() {
//$("h2").html("Carregando..."); //Carregando
},
error: function() {
// $("h2").html("Há algum problema com a fonte de dados");
},
success: function(retorno) {
if(retorno[0].erro){
// $("h2").html(retorno[0].erro);
}
else{
//Laço para criar linhas da tabela
for(var i = 0; i<retorno.length; i++){
itens += "<tr>";
itens += "<td>" + retorno[i].idusuario + "</td>";
itens += "<td>" + retorno[i].desLogin + "</td>";
itens += "<td>" + retorno[i].dessenha + "</td>";
itens += "<td>" + retorno[i].dtcadastro + "</td>";
itens += "</tr>";
}
//Preencher a Tabela
$('.table tbody').html(itens);
//Limpar Status de Carregando
// $("h2").html("Carregado");
}
}
});
$(document).ready(function(){
$("#clicked tr").on('click', function(){
alert('adfsaf');
});
});
}
Shows some error in console?
– Don't Panic
appears this: jquery.min.js (line 4), but works on Chrome
– Mestre Splinter
#clicked
is what? If you use$("#clicked").on('click', 'tr', function(){
already works?– Sergio
#clicked is the <tbody> element id of my table, but your tip already solved my problem, thank you very much there
– Mestre Splinter