There is such a problem: I edit someone else's script, and there ajaxStart and ajaxStop are tightly tied to the script and I need to execute my ajax request on the page so that these events are not triggered. Question: Is it possible to specify this additionally in the ajax (post) method? Or perhaps correct what the author composed. Unfortunately, I did not find the answer on the Internet ..

Here is how the author handles this method (without it, its script () does not work:

jQuery(document).ajaxStart(function () { console.log('ajaxStart'); }); 

For the ajaxStop method is similar.

  • and how did this prevent you from displaying a text message in the console that the ajax starts? - MasterAlex
  • MasterAlex, I reduced the author's code to a minimum, it is not so important. I tried to change the author’s code to jQuery('#container').ajaxStart(function () { console.log('ajaxStart'); }); , but it still works for my ajax request. - Firsim
  • If it is not important, then what is ajaxStart you? :) You can add your code to these functions, in the sense of ajaxStart ? - Moonvvell
  • @Firsim, you write that you have a problem with this code and without it the script does not work, but at the same time consider that this code is not important :) - MasterAlex
  • @MasterAlex, It just is) Difficult to explain .. Just to ensure that this code is important for viewing, you need to upload the entire module) And this is already superfluous information. Thanks for the help) - Firsim

1 answer 1

In general, read the documentation.

If $.ajax() or $.ajaxSetup() is called with the global option set to false, the .ajaxStop() method will not fire. ,

If $.ajax() or $.ajaxSetup() is called with the global option set to false, the .ajaxStart() method will not fire.

Make your request through $.ajax() with the parameter global = false .

  • Thanks that Google didn’t stumble upon it .. $.ajaxSetup({ global: false }); - Firsim