How to send dyanmically generated <tr> to the next page

I am implementing a shopping cart site. When the user adds an item, he will automatically add to the cart with the name of the product and the price in the form of a div. code below

<div class="food_menu_add"><a href="#" id="ad"><img src="images/add.gif" onclick="addcart('Sliced Orange')" /></a></div>
<table id="placehold">
</table>

function addcart(name)
{
  var ni = document.getElementById('placehold');
  var newdiv = document.createElement('tr');
  var divIdName = 'myDiv';
  newdiv.setAttribute('id',divIdName);
  newdiv.innerHTML = name;
  ni.appendChild(newdiv);
}

When you click on the image is generated <tr>. I want to publish <tr>generated on the next page. How can I get this? Help Plz. Any help would be appreciated

+3
source share
2 answers

javascript , , . , - .

+2

:

, , .

, "addcart":

document.cookie =
  'item1=Sliced Orange; expires=Fri, 3 Aug 2011 20:47:11 UTC; path=/'

( , :) , addCart(), cookie.

, , . cookie . body html:

<body onload="LoadCookies()">

LoadCookies() addCart().

+1

Source: https://habr.com/ru/post/1758239/


All Articles