I created a table using arrays:
var html = [];
$.each(data,function(index,item){
no++;
var arr = [
'<tr>',
'<td>'+ no +'</td>',
'<td>'+ item.name +'</td>',
'<td>'+ item.address +'</td>',
'<td>',
'<button type="button" class="btn btn-info btn-sm" onclick="pickData('+ item.id +','+ item.name +','+ item.address +')"><i class="fas fa-plus-circle"></i></button>',
'</td>',
'</tr>'
].join('\n');
html.push(arr);
});
$('#table').html(html);
Here is the accompanying function :
function pickData(id, name, address) {
$("#id").val(id);
$(".name").val(name);
$(".address").val(address);
}
An error has been encountered:
Uncaught SyntaxError: missing ) after argument list
Can you identify where the mistake lies?