0
I’m having a problem with a function call. A table shows the information of a client, and when clicking it should call a function that would show an Alert on the screen with the client’s CPF.
out.println("<table border='1' width=300px>");
for (Cliente cli : lista) {
out.println("<tr>");
out.println("<td><a onclick='getCli(" + cli.getCpfCli().toString() + ");'> " + cli.getNomeCli() +"</a></td>");
out.println("</tr>");
}
out.println("</table>");
function getCli(a){
var cpf = a;
$.ajax({
url: "ajax/getcliente.jsp",
type: "GET",
data: {
cpf : cpf
},
success: function (data) {
comerc = $(data).find("comercial").text();
alert(comerc);
}
});
I am using ajax.