I have table made in Javascript, follow the image below:
FollowtheJavascriptcode(Codeisworkingperfectly):
$(".js-tbody-historico-cliente").on("change", function() {
var codigo_cliente = $(codigoCliente).val();
var tipo_busca = $(tipoBusca).val();
$
.ajax({
type: "GET",
url: "/buscahistoricocliente",
data: ({
codigoCliente: codigo_cliente,
tipoBusca: tipo_busca
}),
dataType: 'json',
success: function(data) {
var text = "";
text += "<thead><tr>" +
"<th class='text-center col-lg-1'>" + data[0][0] + "</th>" +
"<th class='text-center col-lg-1'>" + data[0][1] + "</th>" +
"<th class='text-center col-lg-1'>" + data[0][2] + "</th>" +
"<th class='text-center col-lg-1'>" + data[0][3] + "</th>" +
"<th class='text-center col-lg-1'>" + data[0][4] + "</th>" +
"<th class='text-center col-lg-1'>" + data[0][5] + "</th>" +
"<th class='text-center col-lg-1'>" + data[0][6] + "</th>" +
"<th class='text-center col-lg-1'>" + data[0][7] + "</th>" +
"<th class='text-center col-lg-1'>" + data[0][8] + "</th>" +
"</thead>";
for (i = 1; i < data.length; i++) {
text += "<tbody><tr>" +
"<td>" + data[i][1] + "</td>" +
"<td>" + data[i][4] + "</td>" +
"<td>" + data[i][5] + "</td>" +
"<td>" + data[i][6] + "</td>" +
"<td>" + data[i][7] + "</td>" +
"<td>" + data[i][8] + "</td>" +
"<td>" + data[i][9] + "</td>" +
"<td>" + data[i][10] + "</td>" +
"<td>" + data[i][11] + "</td>" +
"</tr></tbody>";
}
$("#js-tbody-historico-venda-cliente").html(text);
$("#graficosCliente").show();
}
});
});
But instead of appearing the product code in the product column (like the submitted image), I need the image of this product to appear.
I put it this way, but I did something wrong and I would like the help of my colleagues because I have no experience with Js.
$(".js-tbody-historico-cliente").on("change", function() {
var codigo_cliente = $(codigoCliente).val();
var tipo_busca = $(tipoBusca).val();
$
.ajax({
type: "GET",
url: "/buscahistoricocliente",
data: ({
codigoCliente: codigo_cliente,
tipoBusca: tipo_busca
}),
dataType: 'json',
success: function(data) {
var text = "";
text += "<thead><tr>" +
if(data[0][0] == 'BS56EF'){
"<th class='text-center col-lg-1'> <img src="BS56EF"/></th>" +
}
if(data[0][0] == 'FP56EA'){
"<th class='text-center col-lg-1'> <img src="FP56EA"/></th>" +
}
if(data[0][0] == 'FS56EB'){
"<th class='text-center col-lg-1'> <img src="FS56EB"/></th>" +
}
if(data[0][0] == 'FS56EB'){
"<th class='text-center col-lg-1'> <img src="FS56EB"/></th>" +
}
"<th class='text-center col-lg-1'>" + data[0][1] + "</th>" +
"<th class='text-center col-lg-1'>" + data[0][2] + "</th>" +
"<th class='text-center col-lg-1'>" + data[0][3] + "</th>" +
"<th class='text-center col-lg-1'>" + data[0][4] + "</th>" +
"<th class='text-center col-lg-1'>" + data[0][5] + "</th>" +
"<th class='text-center col-lg-1'>" + data[0][6] + "</th>" +
"<th class='text-center col-lg-1'>" + data[0][7] + "</th>" +
"<th class='text-center col-lg-1'>" + data[0][8] + "</th>" +
"</thead>";
for (i = 1; i < data.length; i++) {
text += "<tbody><tr>" +
"<td>" + data[i][1] + "</td>" +
"<td>" + data[i][4] + "</td>" +
"<td>" + data[i][5] + "</td>" +
"<td>" + data[i][6] + "</td>" +
"<td>" + data[i][7] + "</td>" +
"<td>" + data[i][8] + "</td>" +
"<td>" + data[i][9] + "</td>" +
"<td>" + data[i][10] + "</td>" +
"<td>" + data[i][11] + "</td>" +
"</tr></tbody>";
}
$("#js-tbody-historico-venda-cliente").html(text);
$("#graficosCliente").show();
}
});
});
The error that displays is Required String parameter 'CustomerPartner' is not present