-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ajaxStart: Mark the shorthand method as deprecated
- Loading branch information
Showing
2 changed files
with
69 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,69 @@ | ||
<?xml version="1.0"?> | ||
<entry type="method" name="ajaxStart" return="jQuery"> | ||
<title>.ajaxStart()</title> | ||
<signature> | ||
<added>1.0</added> | ||
<argument name="handler" type="Function"> | ||
<desc>The function to be invoked.</desc> | ||
</argument> | ||
</signature> | ||
<entries> | ||
<desc>Register a handler to be called when the first Ajax request begins. This is an <a href="/Ajax_Events/">Ajax Event</a>.</desc> | ||
<longdesc> | ||
<p>Whenever an Ajax request is about to be sent, jQuery checks whether there are any other outstanding Ajax requests. If none are in progress, jQuery triggers the <code>ajaxStart</code> event. Any and all handlers that have been registered with the <code>.ajaxStart()</code> method are executed at this time.</p> | ||
<p>To observe this method in action, set up a basic Ajax load request:</p> | ||
<pre><code> | ||
<div class="trigger">Trigger</div> | ||
<div class="result"></div> | ||
<div class="log"></div> | ||
</code></pre> | ||
<p>Attach the event handler to any element:</p> | ||
<pre><code> | ||
$( document ).ajaxStart(function() { | ||
$( ".log" ).text( "Triggered ajaxStart handler." ); | ||
}); | ||
</code></pre> | ||
<p>Now, make an Ajax request using any jQuery method:</p> | ||
<pre><code> | ||
$( ".trigger" ).click(function() { | ||
$( ".result" ).load( "ajax/test.html" ); | ||
}); | ||
</code></pre> | ||
<p>When the user clicks the element with class <code>trigger</code> and the Ajax request is sent, the log message is displayed.</p> | ||
</longdesc> | ||
<note id="global-ajax-event" type="additional" data-title=".ajaxStart()"/> | ||
<note id="ajax-global-false" type="additional" data-title=".ajaxStart()"/> | ||
<example> | ||
<desc>Show a loading message whenever an Ajax request starts (and none is already active).</desc> | ||
<code><![CDATA[ | ||
$( document ).ajaxStart(function() { | ||
$( "#loading" ).show(); | ||
}); | ||
]]></code> | ||
</example> | ||
<category slug="ajax/global-ajax-event-handlers"/> | ||
<category slug="version/1.0"/> | ||
</entry> | ||
<entry type="method" name="on" return="jQuery"> | ||
<title>ajaxStart event</title> | ||
<signature> | ||
<added>1.7</added> | ||
<argument name=""ajaxStart"" type="string"> | ||
<desc>The string <code>"ajaxStart"</code>.</desc> | ||
</argument> | ||
<argument name="handler" type="Function"> | ||
<desc>The function to be invoked.</desc> | ||
</argument> | ||
</signature> | ||
<longdesc> | ||
<p>Whenever an Ajax request is about to be sent, jQuery checks whether there are any other outstanding Ajax requests. If none are in progress, jQuery triggers the <code>ajaxStart</code> event. Any and all handlers that have been registered with <code>.on( "ajaxStart", ... )</code> are executed at this time.</p> | ||
<p>To observe this method in action, set up a basic Ajax load request:</p> | ||
<pre><code> | ||
<div class="trigger">Trigger</div> | ||
<div class="result"></div> | ||
<div class="log"></div> | ||
</code></pre> | ||
<p>Attach the event handler to any element:</p> | ||
<pre><code> | ||
$( document ).on( "ajaxStart", function() { | ||
$( ".log" ).text( "Triggered ajaxStart handler." ); | ||
} ); | ||
</code></pre> | ||
<p>Now, make an Ajax request using any jQuery method:</p> | ||
<pre><code> | ||
$( ".trigger" ).on( "click", function() { | ||
$( ".result" ).load( "ajax/test.html" ); | ||
} ); | ||
</code></pre> | ||
<p>When the user clicks the element with class <code>trigger</code> and the Ajax request is sent, the log message is displayed.</p> | ||
</longdesc> | ||
<note id="global-ajax-event" type="additional" data-title="ajaxStart"/> | ||
<note id="ajax-global-false" type="additional" data-title="ajaxStart"/> | ||
<example> | ||
<desc>Show a loading message whenever an Ajax request starts (and none is already active).</desc> | ||
<code><![CDATA[ | ||
$( document ).on( "ajaxStart", function() { | ||
$( "#loading" ).show(); | ||
} ); | ||
]]></code> | ||
</example> | ||
<category slug="ajax/global-ajax-event-handlers"/> | ||
<category slug="version/1.0"/> | ||
</entry> | ||
|
||
<entry type="method" name="ajaxStart" return="jQuery" deprecated="3.3"> | ||
<title>.ajaxStart()</title> | ||
<signature> | ||
<added>1.0</added> | ||
<argument name="handler" type="Function"> | ||
<desc>The function to be invoked.</desc> | ||
</argument> | ||
</signature> | ||
<longdesc> | ||
<div class="warning"> | ||
<p>This API is deprecated.</p> | ||
<p>Use <a href="#on1"><code>.on( "ajaxStart", handler )</code></a> instead.</p> | ||
</div> | ||
</longdesc> | ||
<category slug="ajax/global-ajax-event-handlers"/> | ||
<category slug="version/1.0"/> | ||
<category slug="deprecated/deprecated-3.3"/> | ||
</entry> | ||
</entries> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters