Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is a variable jQuery uses internally, but had no reason to hide, so it's there to use. Just a heads up, <a href="http://github.com/jquery/jquery/blob/master/src/ajax.js#L574" rel="noreferrer">it becomes <code>jquery.ajax.active</code> next release</a>. There's no documentation because it's <em>exposed</em> but not in the official API, lots of things are like this actually, like <a href="http://github.com/jquery/jquery/blob/1.4.2/src/data.js#L4" rel="noreferrer"><code>jQuery.cache</code></a> (where all of <a href="http://api.jquery.com/jQuery.data/" rel="noreferrer"><code>jQuery.data()</code></a> goes).</p> <p>I'm guessing here by <em>actual</em> usage in the library, it seems to be there exclusively to support <a href="http://api.jquery.com/ajaxStart/" rel="noreferrer"><code>$.ajaxStart()</code></a> and <a href="http://api.jquery.com/ajaxStop/" rel="noreferrer"><code>$.ajaxStop()</code></a> (which I'll explain further), but they only care if it's 0 or not when a request starts or stops. But, since there's no reason to hide it, it's exposed to you can see the actual number of <strong>simultaneous</strong> AJAX requests currently going on.</p> <hr> <p>When jQuery starts an AJAX request, <a href="http://github.com/jquery/jquery/blob/1.4.2/src/ajax.js#L282" rel="noreferrer">this happens</a>:</p> <pre><code>if ( s.global &amp;&amp; ! jQuery.active++ ) { jQuery.event.trigger( "ajaxStart" ); } </code></pre> <p>This is what causes the <a href="http://api.jquery.com/ajaxStart/" rel="noreferrer"><code>$.ajaxStart()</code></a> event to fire, the number of connections just went from 0 to 1 (<code>jQuery.active++</code> isn't 0 after this one, and <code>!0 == true</code>), this means the first of the current <strong>simultaneous</strong> requests started. The same thing happens at the other end. When an AJAX request stops (because of <a href="http://github.com/jquery/jquery/blob/1.4.2/src/ajax.js#L379" rel="noreferrer">a <code>beforeSend</code> abort via <code>return false</code></a> or an <a href="http://github.com/jquery/jquery/blob/1.4.2/src/ajax.js#L518" rel="noreferrer">ajax call <code>complete</code> function runs</a>):</p> <pre><code>if ( s.global &amp;&amp; ! --jQuery.active ) { jQuery.event.trigger( "ajaxStop" ); } </code></pre> <p>This is what causes the <a href="http://api.jquery.com/ajaxStop/" rel="noreferrer"><code>$.ajaxStop()</code></a> event to fire, the number of requests went down to 0, meaning the last <strong>simultaneous</strong> AJAX call finished. The <a href="http://api.jquery.com/category/ajax/global-ajax-event-handlers/" rel="noreferrer">other global AJAX handlers</a> fire in there along the way as well.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload