Message from JavaScript discussions

November 2017

— Guys


Lets said i have


and the result is

and i want to send ajax to a php server the id of that localstorage data.
usually i use this method in AJAX. data :
data: { 'id': JSON.parse(localStorage.getItem('product'))[0]['id'] },

but the problem is that was i want to send it manually, just one id at once time. Is it possible to make that [0] increase itself with looping or something so i can get all the data in that localstorage ?

— Yes

— Store 0 in a variable

— Increase it when you want to

— With which method ?


isnt it gonna increase until infinity or the system itself break ?

— It only increases when you run ++

— So just don't run ++ infinitely

— Are we talking about a for loop?

— Really?

— Well, he can model it however he wants

— Do you want to send all IDs at the same time, each in their own request?