I have a multi dimentional array called dataArray like below. it may have indexes 0,1,2,3 without a limit.
I am using codeigniter framework. dataArray is all data of a table in the database returned using a model.
0:
status: "1"
added_by: "1"
added_on: "2018-12-12 07:01:23"
approved: 0
c _id: "4"
I pass this array by onclick function when adding datatable rows as below. (in a foreach)
$('#table').DataTable().row.add([
x, //counter
data[j]['action'], //data in foreach
data[j]['status_1'],
data[j]['description'],
data[j]['timestamp'],
'<input type="button" value="..." onclick="openModal(\'' + dataArray + '\')">' // this is passing array
]).draw(false);
openModal function is like below.
function openModal(data_array){
console.log(data_array);
}
above console.log returns only [object Object]. I want to get data and add a foreach here. But data is not showing. Please help on this.
dataArrayis getting generated.dataArray.databut we need to see the where is that variable being filled.