I want to pass array in ajax call -
here code
var itemdetail = []; itemdetail[362] = {'qty':2} $.ajax({ method: 'get', url: url, data: {update_cart_action:'update_qty',cart:itemdetail}, success: function(msg){ } });
i want pass array this
array( [362]=>array( ['qty']=>2 ) )
array pass not passing correct way in console shows this
update_cart_action:update_qty cart[]: cart[]: cart[]: cart[]: cart[]: cart[]: cart[]: cart[]: cart[]: cart[]: .......... cart[362][qty]:2
but want pass this
update_cart_action:update_qty cart[362][qty]:2
how can this? possible in method pass array?
edit
i trying solution
var itemdetail[id] = {};
than give me error uncaught syntaxerror: unexpected token [
another without using var
itemdetail[id] = {};
than give me error itemdetail undefined
another try
var itemdetail = []; itemdetail[id] = {};
than give me type of array
cart[]: cart[]: cart[]: cart[]: cart[]: cart[]: cart[]: cart[]: cart[]: cart[]: .......... cart[362][qty]:2
that javascript does. not problem end, receive like
cart[362][qty]:2
you can try using objects, not arrays.
Comments
Post a Comment