Without much fanfare, I'm stuck on the following problem:
I have the following JS code:
data.forEach(function(item) {
$("#bodyTabelaClientes").append(
"<tr><td style = 'text-align: center'>" + item.nome
+ "</td> <td style = 'text-align: center'> " + item.telefone
+ "</td> <td style = 'text-align: center'> " + item.cep
+ "</td> <td style = 'text-align: center'>" + item.endereco
+ "</td> <td style = 'text-align: center'><button class = 'btn btn-success btnSelecionarCliente' onclick='selecionarCliente("+item+")'>Selecionar</button></tr>");
});
My problem is in the button inside the append, I need to pass this 'item' parameter as parameter to another function, to get the data of this item and do something with them, however, when clicking, the console accuses
Uncaught SyntaxError: Unexpected identifier
with a blank page. I think it's some mistake with the quotes, but I could not identify, does anyone have any idea what to do? Thanks!