Welcome Guest, Not a member yet? Register   Sign In
Using onClick() in view to access database and save in a shopping cart

Hi, I'm new to CI and have a question about the general mechanics behind how the MVC model works. For a project I am working on, in the view we have a list of items that a potential buyer can purchase. When they click on the image of this item, a dialog box appears asking for a quantity to purchase. When the user hits confirm, we want to add the item to their shopping cart (using the shopping cart class) by accessing the data associated with the item from the database. Now, I'm not too sure what the best way to go about this is, but I was thinking that in the javascript embedded in the view, I would need to somehow specify which item the user clicked, access the item's data from the database using functions defined in the model, and then use the controller to add the item from the database to the shopping cart with the specified quantity. Does anyone have any examples that I could look at or any general help? Thank you, much obliged.

Theme © iAndrew 2016 - Forum software by © MyBB