Answer the question
In order to leave comments, you need to log in
How to work with history and AJAX calls correctly?
I add some element to the page using AJAX. Then I follow the link. When I go back, the element has not been saved in history and, of course, is missing. But when I refresh the page with F5, the element appears because I added it to the database during the AJAX call.
How to solve the problem?
Answer the question
In order to leave comments, you need to log in
As far as I understand, it wants to refer to an element that does not exist
If you do not have all the data loaded by Ajax, but only some blocks, it is better to change the url when changing the page state. Like opened the side menu, added /?sidebar=1 to the url. On it and determine what changes are on the page. From the outside, the backend needs to be redone so that it takes into account the parameters when returning a response. If it's a one page app, then there's a slightly different story...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question