Home >Web Front-end >JS Tutorial >js saves the current path (cookies record)_javascript skills

js saves the current path (cookies record)_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:13:561125browse

Simply put, on the personal center page, the customer clicks to cancel the order, submits it to an action, performs database operations, changes the field values ​​​​in a table, and then returns to the personal center page, only there is a "Cancel" button It will be OK if it turns into gray "Cancelled", and on the order details page, it is the same, submitted to the same acion, but the return page is not the personal center page, but the order details page.

At this time, you can consider using js to save the current path, write it to the cookie, and get the path in acion. Through the get/set method, you only need to write in An el expression for the path will do.

The code is as follows:

Copy code The code is as follows:



So as long as the returnUrl is configured in the action, this problem can be easily solved without having to write two actions.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn