how to create multidimensional array / object in jquery and pass via AJAX post how to create multidimensional array / object in jquery and pass via AJAX post codeigniter codeigniter

how to create multidimensional array / object in jquery and pass via AJAX post


You need to quote your keys:

obj['orderItem'] = orderItem;obj['priceEach'] = priceEach;obj['qty'] = qty;

Or use dot notation:

obj.orderItem = orderItem;obj.priceEach = priceEach;obj.qty = qty;

Without the quotes/dot notation its like saying:

obj['Fresh Tilapia Filets'] = 'Fresh Tilapia Filets';obj['$2.99'] = '$2.99';obj[10] = 10;

Because its evaluating the variables with the same name.