javascript - JS dynamic variables or other solution -


i'm building web application-ordering system , i'm working on cart part of front end.

i have array contains plain 1,2,3... count products of cart. every time user clicks product checks array , gives id (for later php use) product on cart.

each product has each own attributes. have no issue adding attributes product. each attribute gets id resulting in attribute_1_1,attribute_1_2 first number product no on cart , second 1 attribute no on product.

problem i'm facing when removing attribute.

if example product 1 has attribute_1_1,attribute_1_2,attribute_1_3 , remove no 2 attribute js give next added attribute id of attribute_1_4 therefor when checking in php how many set it'll stop @ 1 because attribute_1_2 missing.

either have make array each product it's attributes (in case i'll need dynamic variable var arraysattr+somethinghere=new array(); don't know now, or if there solution i'm missing please go ahead.

thank you


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -