/* globals $*/
$(document).ready(function () {

    $('#loadShoppingCart').on('click', function () {

//1.strigify objecta kogato se sazdava, vkarvash go v storaga
// 2. prashta se vinagi stringifynat object
// 3. vseki edin input field predstavlqva property v objecta teq.body
// .4 ako e masiv ot obekti pristiga kato req.body . name :[object object],koeto v deistvitelnost predstavqva stringifinatiqt obekt
// 5 pravi se iteraciq po propertita na req.body i se parstva vsqko valu


        var form = $("<form/>",
            {
                action: '/basket',
                method: 'POST',
                headers: {
                    "content-type": "application/json"
                }
            });
        for (let i = 1; i < localStorage.length; i++) {

            $('<input>').attr('type', 'hidden')
                .attr('name', "product" + i)
                .attr('value', (localStorage.getItem(i.toString())))
                .appendTo(form)

        }

        $(document.body).append(form);
        form.submit();


        return false; // cancel the actual link
    });

});
@@ -719,57 +719,137 @@
     
-for (let i = 1; i %3C localStorage.length; i++
+let keysLocalStorage=Object.keys(localStorage);%0A%0A        for (let key of keysLocalStorage) %7B%0A            if (Number(key)
 ) %7B%0A%0A
+    
     
@@ -904,24 +904,28 @@
             
+    
 .attr('name'
@@ -942,11 +942,17 @@
 %22 + 
-i)%0A
+key)%0A    
     
@@ -1004,24 +1004,19 @@
 tem(
-i.toString())))%0A
+key)))%0A    
     
@@ -1042,16 +1042,30 @@
 To(form)
+%0A            %7D
 %0A%0A      

load basket updating localstorage when delete