After switching the page, the ajax response of the previous page returned, but the error report of the page element could not be found. How to solve this problem?

for a single-page application, the current page issues an ajax request. Before the response is returned, the main page on the right side is switched when the menu is switched, and the ajax response of the previous page is returned. There are too many scenarios in which an error is reported because the elements of the page before the switch cannot be found. If it is troublesome to judge whether a page element exists or not in every request, solve the problem.
Thank you.

Feb.28,2021

add a judgment to determine whether this element exists


so when you get the ajax response, just judge whether the current page (route) has changed

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31748-2bd8b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31748-2bd8b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?