From table to array jquery objects -
I am trying to collect values of custom data attributes using each
.
Even I have so far
that JQ / JS
var multi = $ ( '._____________' Var myarray = []; $ .each (multi, function (index, item) {myarray.push ({name: 'ticket_row_num', value: $ (item). Data ('ticket_OR_num')}); Myarray.push ({name: 'itemtitle', value: $ (item) .data ('item title')}) myarray.push ({name: 'row_quantity', value: $ (item). Data ('row_quantity 'Myarray.push' ({name: 'Rowunitprice', Value: $ (item) .data ('queue')}) myarray.push ({name: 'row_total', value: $ (item) Data ('row_total')}) // myarray.push ({name: 'measure_type_is_grams', value: $ (item). Data (' measure_type_is_g Rams')}}}}; myArray;
The issue is that I am coming back to [object, object]
and I do not know Why
I am very unfamiliar with the arrays in JS / JQ and I am trying not to do it for greater profit.
That's because you have an array of objects, which when converts to a string, gives O / P [object, object] instead. Words to alert (JSON.stringify (myarray));
- This will give a Jason presentation of the object.
This is happening because the default toString ()
implementation of an object [object object]
Comments
Post a Comment