In Part 104 of the Laravel 9 Tutorial to create a Multi-Vendor E-commerce Website in Laravel 9, we will continue working on the shopping cart page.
In this video, we will work on the delete cart item functionality via Ajax.
1) Update cart_items.blade.php file:-
First of all, update the delete cart item button with data-cartid attribute from where we will pass the cart id to jQuery/Ajax and add class deleteCartItem to run jQuery function on click.
2) Update custom.js file :-
Now add jQuery function that will run on click of class deleteCartItem where we will get cartid and send to route and function via Ajax.
3) Create Route :-
Now create post route to delete the cart item in the web.php file like below:-
// Delete Cart Item
Route::post('/cart/delete','ProductsController@cartDelete');
4) Create cartDelete function :-
Now create the cartDelete function from where we will delete cart items and update the shopping cart without refreshing the page.
5) Add Confirm Check :-
Now we will add simple javascript confirm check to confirm the user before deleting the cart item.
We will add this check in the jQuery function as shown in the video.
►Laravel 9 Tutorial (Create Multi-Vendor E-commerce Website) - • Laravel Multi Vendor Tutorial
►Laravel 9 Playlist - • Learning Laravel 9
►Click here to subscribe for Laravel & other updates - / stackdevelopers
Popular Stack Developers Series that can help you:-
►Laravel Tutorial for Beginners - • Laravel Tutorial for Beginners | Adva...
►GIT Tutorial for Beginners - • Git Tutorial for Beginners | Create y...
►Laravel API Tutorial - • Laravel API Tutorial | Create API fro...
►Laravel Interview Questions - • Laravel Interview Questions & Answers...
►jQuery Tutorial - • jQuery Tutorial
►Laravel Basic E-commerce Series - • Make Admin Panel / E-commerce Website...
►Laravel Dating Series - • Make Dating / Social Networking Websi...
►Join this channel to get the complete source code of all series:
/ @stackdevelopers
Follow Stack Developers on Social Media to get updates and resolve your queries
►Like Facebook Page to get updates - / stackdevelopers2
►Join Facebook Group to resolve your queries - / stackdevelopers
►Follow on Instagram - / stackdevelopers2
►Follow on GitHub - https://github.com/stackdevelopers
#laravel9 #laravel9tutorial #laravel
Смотрите видео Laravel 9 Tutorial онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Stack Developers 01 Январь 1970, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 940 раз и оно понравилось 19 людям.