laravelshoppingcart
laravelshoppingcart copied to clipboard
Add to cart : dynamic?
Sir One question.... As you have used the add to cart operation. and for add to cart operation the page reload. If I want to do so without reloading the page. mean when I click on add to cart it will dynamically add on the cart. So that page don't need to reload. So is it possible to do so with this package? or I need to use other method instead of using this package?
I think the best way to do this would be to use Ajax. You can see it running at https://shoppingcart-demo.darrylfernandez.com/cart as an example. In this example, axios (this$http.post, for example) are used in Vue.js that make a dynamic query and load the data from the form to the table without reloading the screen.
Here is the repo of the working example mentioned https://github.com/darryldecode/laravelshoppingcart-demo
Here is an example according to the Vue.js documentation (you can use other frameworks too) https://vuejs.org/v2/cookbook/using-axios-to-consume-apis.html
Quite simply, you will basically do this
this.$http.post('/someurl', this.object).then(function (response) { // Success console.log(response.data) },function (response) { // Error console.log(response.data) });
@webfelipemaia Thanks bro for your suggestion. I will follow the mentioned steps.... :D