Open json.parse(sessionstorage) array and add to ado recordset

I an using Java script for ADD to Cart.

I need to submit the cart and get the array in session storage to my ADO recordset.

How can i do it?

//<script type="text/javascript" language="javascript">   
// ************************************************
// Shopping Cart API
// ************************************************

var shoppingCart = (function() {
  // =============================
  // Private methods and propeties
  // =============================
  cart = [];
  
  // Constructor
  function Item(name, length, price, count, imag, gst, desc ) {
    this.name = name;
    this.price = price;
    this.count = count;
	this.length = length;
	this.imag = imag;
	this.gst = gst;
	this.desc = desc;
  }
  
  // Save cart
  function saveCart() {
    sessionStorage.setItem('shoppingCart', JSON.stringify(cart));
  }
  
    // Load cart
  function loadCart() {
    cart = JSON.parse(sessionStorage.getItem('shoppingCart'));
	
  }
  if (sessionStorage.getItem("shoppingCart") != null) {
    loadCart();
	
  }
  

  // =============================
  // Public methods and propeties
  // =============================
  var obj = {};
  
  // Add to cart
  obj.addItemToCart = function(name, length, price, count, imag, gst, desc) {
    for(var item in cart) {
      if(cart[item].name === name) {
        //cart[item].count ++;
		 alert("You already have this in your Order");
        //isProductInCart = true;
        saveCart();
        return;
      }
    }
    var item = new Item(name, length, price, count, imag, gst, desc);
    cart.push(item);
    saveCart();
  }
  // Set count from item
  obj.setCountForItem = function(name, count) {
    for(var i in cart) {
      if (cart[i].name === name) {
        cart[i].count = count;
        break;
      }
    }
  };
  // Remove item from cart
  obj.removeItemFromCart = function(name) {
      for(var item in cart) {
        if(cart[item].name === name) {
          cart[item].count --;
          if(cart[item].count === 0) {
            cart.splice(item, 1);
          }
          break;
        }
    }
    saveCart();
  }

  // Remove all items from cart
  obj.removeItemFromCartAll = function(name) {
    for(var item in cart) {
      if(cart[item].name === name) {
        cart.splice(item, 1);
        break;
      }
    }
    saveCart();
  }

  // Clear cart
  obj.clearCart = function() {
    cart = [];
    saveCart();
  }

  // Count cart 
  obj.totalCount = function() {
    var totalCount = 0;
    for(var item in cart) {
      totalCount += cart[item].count;
    }
    return totalCount;
  }

  // Total cart
  obj.totalCart = function() {
    var totalCart = 0;
    for(var item in cart) {
      totalCart += cart[item].price * cart[item].count;
    }
    return Number(totalCart.toFixed(2));
  }

  // List cart
  obj.listCart = function() {
    var cartCopy = [];
    for(i in cart) {
      item = cart[i];
      itemCopy = {};
      for(p in item) {
        itemCopy[p] = item[p];

      }
      itemCopy.total = Number(item.price * item.count).toFixed(2);
      cartCopy.push(itemCopy)
    }
    return cartCopy;
  }

  // cart : Array
  // Item : Object/Class
  // addItemToCart : Function
  // removeItemFromCart : Function
  // removeItemFromCartAll : Function
  // clearCart : Function
  // countCart : Function
  // totalCart : Function
  // listCart : Function
  // saveCart : Function
  // loadCart : Function
  return obj;
})();


// *****************************************
// Triggers / Events
// ***************************************** 
// Add item
$('.add-to-cart').click(function(event) {
  event.preventDefault();
  var name = $(this).data('name');
  var price = Number($(this).data('price'));
  var length = Number($(this).data('length'));
  var imag = $(this).data('imag');
  var gst = Number($(this).data('gst'));
 // var desc = $(this).data('desc'));
  var desc = document.getElementById("orderdesc").value;
//var rdesc = desc.toString();
// var res = str.toString();
//  document.getElementById("orderdesc").innerHTML = res;
 // var desc = $(this).data('desc');
//  var desc = $('orderdesc').val();
  
  
  shoppingCart.addItemToCart(name, length, price, 1, imag, gst, desc);
  displayCart();
});

// Clear items
$('.clear-cart').click(function() {
  shoppingCart.clearCart();
  displayCart();
});


function displayCart() {
  var cartArray = shoppingCart.listCart();
  var output = "";
  for(var i in cartArray) {
    output += "<tr>"
	 // <img class="imgitem" src='/bill/photo/.jpg' onerror="this.onerror=null; this.src='/bill/wap2/images/NoPic.jpg';" width="100%">
	  + "<td rowspan='3'>" + "<img width='100px' height='auto' onerror='this.onerror=null; this.src='/bill/wap2/images/NoPic.jpg'' src= " + cartArray[i].imag +"></td>" 
      + "<td style='font-size: 14pt'>" + cartArray[i].name + "</td>"
	  + "<td style='font-size: 14pt'>(" + cartArray[i].length + ")</td>"
	  + "<td class='gst' style='font-size: 11pt'>" + cartArray[i].gst + "%GST</td>"
	  + "</tr>"
	 //+ "<td><div class='input-group'><button class='minus-item input-group-addon btn btn-primary' data-name=" + cartArray[i].name + ">-</button>"
      //+ "<input type='number' class='item-count form-control' data-name='" + cartArray[i].name + "' value='" + cartArray[i].count + "'>"
   //   + "<button class='plus-item btn btn-primary input-group-addon' data-name=" + cartArray[i].name + ">+</button></div></td>"
    //  + "<td>" + cartArray[i].total + "</td>" 
      + "<tr>"
	  +" <td style='font-size: 14pt'>" + cartArray[i].price + "</td>" 
	  +"<td></td>"
     // + " = " 
      + "<td><button class='delete-item btn btn-danger' data-name=" + cartArray[i].name + ">X</button></td>"
      + "<tr>"
	  + "<td colspan='100%' style='font-size: 12pt'>" + cartArray[i].desc + "</td>"
	  + "</tr>"
	  + " <tr style= 'border-bottom:1px solid black'><td colspan='100%'></td>"
	  +	"</tr>";
	  
  }
  $('.show-cart').html(output);
  $('.total-cart').html(shoppingCart.totalCart());
  $('.total-count').html(shoppingCart.totalCount());
}

function SubmitCart() {
  var cartArray1 = shoppingCart.listCart();
   for(var i in cartArray1) {
	  var name = cartArray1[i].name
	  var length = cartArray1[i].length;
	  var price = cartArray1[i].price;
	  var imag = cartArray1[i].imag;
	  var gst = cartArray1[i].gst;
	 var desc = cartArray1[i].desc;
	}  
  $('.submit-cart').html(imag);
 
}
// submit items
$('.submit-cart').click(function() {
  SubmitCart();
});

// Delete item button

$('.show-cart').on("click", ".delete-item", function(event) {
  var name = $(this).data('name')
  shoppingCart.removeItemFromCartAll(name);
  displayCart();
})


// -1
$('.show-cart').on("click", ".minus-item", function(event) {
  var name = $(this).data('name')
  shoppingCart.removeItemFromCart(name);
  displayCart();
})
// +1
$('.show-cart').on("click", ".plus-item", function(event) {
  var name = $(this).data('name')
  shoppingCart.addItemToCart(name);
  displayCart();
})

// Item count input
$('.show-cart').on("change", ".item-count", function(event) {
   var name = $(this).data('name');
   var count = Number($(this).val());
  shoppingCart.setCountForItem(name, count);
  displayCart();
});

displayCart();

Thank you if any one can help

Read about using AJAX using the POST method to your backend.

i am new to this. could you please guide me ? i need to get the array in ado recordset in the submit order page.

                    Set objrs1 = Server.CreateObject("ADODB.RecordSet")
                    Set objrs2 = Server.CreateObject("ADODB.RecordSet")
                    Set objrs3 = Server.CreateObject("ADODB.RecordSet")
                    
					objrs1.open "SELECT DISTINCT [order_id] FROM custorder", objconn

                    Dim p
                    p = 1000
                    Do While Not objrs1.EOF
                        p = p + 1
                    objrs1.MoveNext
                    Loop 
                    objrs1.Close
                    
                    objrs2.open "custorder",objconn,adLockOptimistic, adCmdTable

                    Dim mycount
                    mycount = Session("cnt")
                    p = p + 1
                    For j = 0 to mycount-1 
                         objrs2.AddNew
                         objrs2("odate") = date()
                         objrs2("order_id") = p
                         'objrs2("refno") = Session("Bill_session")(j)  
                         objrs2("login") = Session("email")
                         objrs2("email") = Session("email")
                         objrs2("user_id") = Session("user_id")
                         objrs2("description") = Request.querystring("description")
                         objrs2.Update
                     Next

i need to get array of products details in recordset as well as “total count” as session count