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:
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