Please disregard this question.
I had zero idea what I needed to ask, which is why this question is phrased in a confusing manner, leading answerers astray. With the help of all the comments and answers, I now know what I need to look for.
Thank you all, and please vote to close this question.
It looks like you want to save the info to a database on a server. In that case you would send the data through a POST http request (probably using ajax), receive it in a route on your server, save the info to a database, and then write backend code to use the information from the database however you see fit.
If you want to save the data just while the page is open, use a variable.
If you want to save it across sessions of the same page, but not forever, use
localStorage or cookies.
If you want to save it for as long as you want, store the information in a database on a server.