I am working on an ecommerce solution using opencart, that has a bunch of checkboxes in order to batch update.
This field is a custom field and what I’m looking to do, is when the user selects these and then continues shopping when they return, they are checked.
I have the following code:
<input class="something" type="checkbox" value="£11.75" name="vat[]">
<input class="something" type="checkbox" value="£25.75" name="vat[]">
So when the first one is checked, it needs to be added to the session.
How woukd I do this? Could I use javascript/jquery to do an Ajax post to a script that would set the session for each checkbox?
Thanks
You’d use something like this
however, you should ask yourself if it’s really required that every change in a checkbox be immediately sent to the server. Does checking off
£11.75mean that other tabs/windows on the site must be aware of that change? If it’s just to update a shopping cart, then wait until the user’s done making their changes, THEN send the current values to the server in-bulk. Otherwise you’re just using up bandwidth and server resources for no good reason.