I am working on an basic Shopping Cart
assignment in Springs
. The functionalities of the assignment are just to display a given set of products - with info (with an add to cart button). My problem is, integrating the Add button click
with the shopping cart display in the JSP
page.
How to use application session to obtain and persist information across multiple "Add
" button clicks?
Here is the code snippet:
<script type="text/javascript">
var noOfClicks = 0; // Used to count the number of Clicks.
function button_click() {
noOfClicks++; // On click of the button the value is incremented.
document.getElementById("item").value = noOfClicks;
}
</script>
How do I check if the button is clicked and add it to cart with its attributes (Quantity, Price etc) in a separate summary table?