I am currently using NodeJS & Express to load webpages which contain element content that is rendered via a query to MongoDB.
A GET request will create Button elements, binding the MongoDB _id to each button.
I am designing a Point of Sale system. Each button is an item with an associated price on the Database server. I can query the DB for the price of each item by passing in this _id into an OnClick function.
Each time the client registers an order of a particular item, I have to query the Database.
I could avoid querying the Database with each button click. When the webpage is loaded, I can simply store the price as the value attribute of the button. This will allow me to reduce the amount of requests the server gets by hundreds or thousands. But I will be essentially storing the model in the view.
Is this bad? Why? The functionality is the same, and the load is reduced.
Sorry if this is a dumb question, I'm just curious