How can i stop ajax request (don't wait untill response come)?

后端 未结 5 929
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-10 18:46

If I use Ajax to send request and this request take long time ..... if I want to send anther request what should I do?

the current behaviour the second request

5条回答
  •  别跟我提以往
    2021-02-10 19:00

    Defining the ajax request variable:

    var xhr;
    

    Making the ajax call:

    xhr = $.ajax(...);
    

    Aborting the ajax call:

    xhr.abort();
    

提交回复
热议问题