Skip to content

Added note for Global Ajax Event Handlers #797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions entries/ajaxComplete.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ $( document ).ajaxComplete(function( event, xhr, settings ) {
</code></pre>
<p><strong>Note:</strong> You can get the returned ajax contents by looking at <code>xhr.responseText</code>.</p>
</longdesc>
<note id="global-ajax-event" type="additional" data-title=".ajaxComplete()"/>
<note id="ajax-global-false" type="additional" data-title=".ajaxComplete()"/>
<example>
<desc>Show a message when an Ajax request completes.</desc>
Expand Down
1 change: 1 addition & 0 deletions entries/ajaxError.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ $( document ).ajaxError(function( event, jqxhr, settings, thrownError ) {
}
});</code></pre>
</longdesc>
<note id="global-ajax-event" type="additional" data-title=".ajaxError()"/>
<note id="ajax-global-false" type="additional" data-title=".ajaxError()"/>
<example>
<desc>Show a message when an Ajax request fails.</desc>
Expand Down
1 change: 1 addition & 0 deletions entries/ajaxSend.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ $( document ).ajaxSend(function( event, jqxhr, settings ) {
});
</code></pre>
</longdesc>
<note id="global-ajax-event" type="additional" data-title=".ajaxSend()"/>
<note id="ajax-global-false" type="additional" data-title=".ajaxSend()"/>
<example>
<desc>Show a message before an Ajax request is sent.</desc>
Expand Down
1 change: 1 addition & 0 deletions entries/ajaxStart.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ $( ".trigger" ).click(function() {
<p>When the user clicks the element with class <code>trigger</code> and the Ajax request is sent, the log message is displayed.</p>
<p><strong>As of jQuery 1.8, the <code>.ajaxStart()</code> method should only be attached to <code>document</code>.</strong></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>
Expand Down
1 change: 1 addition & 0 deletions entries/ajaxStop.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ $( ".trigger" ).click(function() {
<p>When the user clicks the element with class <code>trigger</code> and the Ajax request completes, the log message is displayed.</p>
<p><strong>As of jQuery 1.8, the <code>.ajaxStop()</code> method should only be attached to <code>document</code>.</strong></p>
</longdesc>
<note id="global-ajax-event" type="additional" data-title=".ajaxStop()"/>
<note id="ajax-global-false" type="additional" data-title=".ajaxStop()"/>
<example>
<desc>Hide a loading message after all the Ajax requests have stopped.</desc>
Expand Down
1 change: 1 addition & 0 deletions entries/ajaxSuccess.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ $( document ).ajaxSuccess(function( event, xhr, settings ) {
</code></pre>
<p><strong>Note:</strong> You can get the returned ajax contents by looking at <code>xhr.responseXML</code> or <code>xhr.responseText</code> for xml and html respectively.</p>
</longdesc>
<note id="global-ajax-event" type="additional" data-title=".ajaxSuccess()"/>
<note id="ajax-global-false" type="additional" data-title=".ajaxSuccess()"/>
<example>
<desc>Show a message when an Ajax request completes successfully.</desc>
Expand Down
3 changes: 3 additions & 0 deletions notes.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
<xsl:when test="@id = 'detach-shorthand'">
As the <code>.<xsl:value-of select="@data-event"/>()</code> method is just a shorthand for <code>.on( "<xsl:value-of select="@data-event"/>", handler )</code>, detaching is possible using <code>.off( "<xsl:value-of select="@data-event"/>" )</code>.
</xsl:when>
<xsl:when test="@id = 'global-ajax-event'">
As of jQuery 1.9, all the handlers for the <a href="/category/ajax/global-ajax-event-handlers/">jQuery global Ajax events</a>, including those added with the <code><xsl:value-of select="@data-title"/></code> method, <em>must</em> be attached to <code>document</code>.
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>