im trying to create a final object with data in it, all of the elements are numbers except for one of them, and that one is to hold more objects. here is what i have so far.
var data = '';
$(".item-element").each(function(e) {
var id = this.id;
var qty = parseInt($("#" + this.id + " .element-qty").text());
});
var sale_data = {
"id" : $('#sales_id').val(),
"cid" : $('#sales_custom').val(),
"status" : $('#sales_status').val(),
"data" : {
"services" : service_data,
"products" : product_data
},
"total" : Number($('#sale-total').text().substr(1)),
};
im trying to get product_data to hold the following type structure from the values of the id and qty in the each loop. the final data entry to look like this based on the each loop.
"data" : {
"services" : service_data,
"products" : {
{id:qty},
{id:qty},
{id:qty}
}
},