Home >Backend Development >PHP Tutorial >javascript - How to return to the interface opened by ajax

javascript - How to return to the interface opened by ajax

WBOY
WBOYOriginal
2016-08-18 09:16:15920browse

I entered a page and clicked on the store inside to perform ajax operation. I switched the style and clicked on the menu function inside to enter the menu page. There was a return on the page. When I clicked back, I found that I could not return to the interface with ajax. I could only return to the interface without ajax. Can anyone help me? Do you know what to do

Reply content:

I entered a page and clicked on the store inside to perform ajax operation. I switched the style and clicked on the menu function inside to enter the menu page. There was a return on the page. When I clicked back, I found that I could not return to the interface with ajax. I could only return to the interface without ajax. Can anyone help me? Do you know what to do

There are many ways; hash cookie localStorage, etc.

When using ajax to switch a single page, you need to save the history record, so that you can monitor the corresponding return action when you return, and then make the corresponding page switch.
location.hash and history.pushstate will help you

http://www.zhangxinxu.com/wor...

The legendary pjax

You need pjax

Use cookies to record a value passed to ajax. No matter how you open the previous page, the cookie value just now will be used, so that it will not change

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