I want to create a shopping cart in that the products would be fetched from database. I would create a web method but need to call this webmethod using ajax.
How to refresh the cart on the same page whenever new item is added using ajax?
You will need to initialise your shopping cart at load time
let shoppingCart = []; // array of objects
First define what information you want to store in it that will be the attributes of your cart item object for instance: id, quantity, lable, price, sum start from that and give us feed back
then we'll help you further
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.