Hanner Hanner - 1 month ago 9
jQuery Question

How to send javascript object to php via ajax?

I looked at some other questions such as this and this, but it does not me help me solve my problem. When I console-log my data, I get this:

Object["row_LM#00000010", "row_LM#00000002", "row_LM#00000009", "row_LM#00000008"]

How can I get this in php as a key value pair like row_ : LM#00000010, row_LM#00000002, row_LM#00000009,LM#00000008, so that I can loop each value? I tried JSON.stringify(), I got
TypeError: cyclic object value

Here's what I have tried:

success: function(data){
//other codes

The console.log of
gave me:

Object["row_LM#00000010", "row_LM#00000002", "row_LM#00000009", "row_LM#00000008"]

The base data comes from datatable

var deleteInvoice = dt.rows( { selected: true } ).ids();

Please help.


According to this page (https://datatables.net/forums/discussion/30848/trying-to-get-get-the-row-ids-using-rows-ids), you are getting a dataTables object instance. To get an array, you'd do this:

table.rows( { selected: true } ).ids().toArray();

It might help to simplify what you're working with, the dataTables object might be what's going cyclic on you.