How to interrupt the asynchronous request of ajax or axios?

because when vue routes to a route, the data requested through ajax jumps to another routing page before it is returned, but the last axios asynchronous request is still being processed, so it does not meet expectations. How to deal with this situation?

Feb.27,2021

$.ajax has a return object on which you can call the abort method to cancel the request.


axios supports cancellation
axios document cancellation


since the ajax data is not returned, then either the ajax data is not returned, or the jump is performed after the ajax is completed.


shouldn't the real problem be to skip routing after asynchronous processing? How to become a discussion of how to cancel an ajax request.


you can use async/await asynchronous programming to handle
axios interception?
I think await can wait for async to return promise before processing the jump

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-1b9d835-51fee.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-1b9d835-51fee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?