function show(array){
console.log(array);
}
function main() {
var send = ["HOLA", "ADIOS"];
$('#table').append('<tr>'+
'<td style="width: 35%">Oscar</td>'+
'<td style="width: 6%">'+
'<button type="button" class="btn btn-success" data-dismiss="modal" onclick=show('+send+')>+</button>'+
'</td>'+
'</tr>'
);
}
main();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table id="table" class="table table-bordered">
<thead>
<tr>
<th style="width: 35%" id="wallet-modal-table-name-header"></th>
<th style="width: 6%" id="wallet-modal-table-options-header"></th>
</tr>
</thead>
</table>
I have this code and I want to send the array "send" but when I send it as a parameter in the functions it shows me an error. What could I do?
addEventListener(event, handler)your approach is concatenating the object/array rather than actually passing that array as param.