Stop $.ajax on beforeSend

后端 未结 4 704
南笙
南笙 2020-12-01 04:59

I have this jQuery ajax call:

$.ajax({
    url : \'my_action\',
    dataType: \'script\',
    beforeSend : function(){
        if(1 == 1) //just an example
          


        
4条回答
  •  粉色の甜心
    2020-12-01 05:50

    $.ajax({
        url : 'my_action',
        dataType: 'script',
        beforeSend : function(xhr, opts){
            if(1 == 1) //just an example
            {
                xhr.abort();
            }
        },
        complete: function(){
            console.log('DONE');
        }
    });
    

提交回复
热议问题