0

I literally looked up all topics on how to pass a variable from a JS file, linked to a HTML page, into another HTML file So, i have a HTML, page1, in which products are selected and added to a "shopping cart" in the same page The js file linked to page1 gets all products price, names and images, and add them to the cart section in the HTML, thus creaing a matrix in which there are arrays of prices, titles of the product and so on Summing all up, I have this last matrix, as a variable, that i need to put into my new HTML page, "page2.html"

The problem is that when i press the button "Go to checkout" I dont know how to open the second HTML page, from the first js file, after it got all the products infos, and how to pass al the infos into the new HTML file, opened on click

hope I got clear enought with all I wrote, and I hope you can help me anytime soon thanks

  • https://stackoverflow.com/questions/17502071/transfer-data-from-one-html-file-to-another – Scott Marcus Jul 20 '20 at 17:10
  • This doesn't help but I appreciate Its kind of impossible to find the solution to my problems becuase is not related to a form Is just a js variable that has to be put into a html file Yet it seems an impossible task to achieve Could I at least use a single JS file for 2 html pages, in which it retrieves items from the first and build other items (divs, p, span) in the second? –  Jul 20 '20 at 17:46
  • That link describes exactly what you need to do. Whether the data is from a form or a variable doesn't change the procedure, just where the data comes from. This is hardly impossible. In fact, it's incredibly easy, you just have to take the time to learn. – Scott Marcus Jul 20 '20 at 18:06

0 Answers0