简体   繁体   中英

Filter products using ajax in Laravel

I am building a store website that has implemented sorting and filtering products with ajax. In fact, with ajax I send a request to the server and receive the filtered products and place them in the view. Now I have a problem. In fact, when the product filter is applied, I click on a product to see the page of that product. After viewing, when I try to go back to the products page, all the filters or sorts disappear and I have to apply the filters again from the beginning.

What is the solution to this problem?

There are two ways you can archive that. You can set the sorting and filtering values in the session on the server OR In local storage through JavaScript and reuse them while coming back to products page.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM