jquery abort() ajax request before sending another

前端 未结 4 1039
庸人自扰
庸人自扰 2020-11-29 21:54

Based on: Abort Ajax requests using jQuery... In inventory_search() - before the ajax request is made, how can I check for any current requests and abort() them before makin

4条回答
  •  时光取名叫无心
    2020-11-29 22:12

    Pretty easy with jQuery AjaxManager Plugin:

    $.manageAjax.create('unique_identifier',{
    queue:'clear',cacheResponse:false,maxRequests:1,abortOld:true
    });
    jQuery.manageAjax.abort('unique_identifier');
    jQuery.manageAjax.clear('unique_identifier');
    jQuery.manageAjax.add('unique_identifier',{success: function(data) {}});
    

提交回复
热议问题