Home  >  Article  >  Web Front-end  >  How to use jquery ajax abort()_jquery

How to use jquery ajax abort()_jquery

WBOY
WBOYOriginal
2016-05-16 18:17:381441browse

Since I am using jquery, I couldn’t find the .abort() method in the manual. I searched online and saw about the .abort() method in jquery at http://ooxx.me/jquery-ajax-abort.orz. ) Usage method, use the example directly:

Copy code The code is as follows:

current_request = $. get('/events', { 'Qixi': '发春' },function(resp) { alert(resp); });
if(current_request) {current_request.abort();}


But when you use this current_request.abort(); method to cancel, the $.ajax success event will actually be triggered, so the callback function in success needs to be added to determine whether current_request exists, and the callback will be executed only if it exists. Function
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