0

How do I display values immediately to a table after I click a submit button in JSP and use it for furthermore functions? Because I have this simple POS system exercise wherein I need to add products and show it on a table together with the corresponding prices and quantity. After that, calculate the total price and deduct it with the inputted money and display the change. I'm not using any framework just pure JSP.

Here's a sketch that might help: enter image description here

Kael
  • 391
  • 1
  • 10
  • 21

1 Answers1

0

With jQuery you can add the on submit form, and then you have to prevent the form from submitting. Example:

$(document).on("submit", "form", function (event) {
            var $form = $(this);

            $.post($form.attr("action"), $form.serialize(), function (responseJson) {
                 //add your table here
            });

            event.preventDefault(); // Important! Prevents submitting the form.

});
Romy
  • 272
  • 2
  • 11