This article is a mirror article of machine translation, please click here to jump to the original article.

View: 12817|Reply: 1

[Jquery] jquery listens for all ajax request completion statuses

[Copy link]
Posted on 11/12/2020 11:44:59 AM | | | |
Scenario: Nowadays, many web projects use Ajax to request data rendering and update the information in the page, but if the page is not operated for a long time, it may cause the login to expire, and there may be problems with the return data we obtain, which means we need to jump to the login interface.

The code is as follows:


We can use responseJSON or status to determine whether the login is invalid, and logically verify it according to our actual business situation. If Ajax is exceptional, the ajaxComplete completion event will also be triggered normally. As shown below:







Previous:.NET Core displays registered services and implementations and their lifecycles
Next:Linux hosts.allow hosts.deny security settings
 Landlord| Posted on 6/22/2023 10:30:20 AM |
The ajax-hook for web development intercepts all XMLHttpRequest requests
https://www.itsvse.com/thread-10616-1-1.html
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com