Skip to content

Commit 891e94b

Browse files
Fixing typo on Example code block
Fixing: - Example code block formatting and typo.
1 parent df921c4 commit 891e94b

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

entries/ajaxSuccess.xml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,37 +28,37 @@
2828
</code></pre>
2929
<p>Attach the event handler to any element:</p>
3030
<pre><code>
31-
$( document ).on( "ajaxSuccess", function() {
32-
$( ".log" ).text( "Triggered ajaxSuccess handler." );
33-
} );
31+
$( document ).on( "ajaxSuccess", function() {
32+
$( ".log" ).text( "Triggered ajaxSuccess handler." );
33+
} );
3434
</code></pre>
3535
<p>Now, make an Ajax request using any jQuery method:</p>
3636
<pre><code>
37-
$( ".trigger" ).on( "click", function() {
38-
$( ".result" ).load( "ajax/test.html" );
39-
} );
37+
$( ".trigger" ).on( "click", function() {
38+
$( ".result" ).load( "ajax/test.html" );
39+
} );
4040
</code></pre>
4141
<p>When the user clicks the element with class <code>trigger</code> and the Ajax request completes successfully, the log message is displayed.</p>
4242
<p>All <code>ajaxSuccess</code> handlers are invoked, regardless of what Ajax request was completed. If you must differentiate between the requests, you can use the parameters passed to the handler. Each time an <code>ajaxSuccess</code> handler is executed, it is passed the event object, the <code>XMLHttpRequest</code> object, and the settings object that was used in the creation of the request. For example, you can restrict the callback to only handling events dealing with a particular URL:</p>
4343
<pre><code>
44-
$( document ).on( "ajaxSuccess", function( event, xhr, settings ) {
45-
if ( settings.url == "ajax/test.html" ) {
46-
$( ".log" ).text( "Triggered ajaxSuccess handler. The Ajax response was: " +
47-
xhr.responseText );
48-
}
49-
} );
44+
$( document ).on( "ajaxSuccess", function( event, xhr, settings ) {
45+
if ( settings.url == "ajax/test.html" ) {
46+
$( ".log" ).text( "Triggered ajaxSuccess handler. The Ajax response was: " +
47+
xhr.responseText );
48+
}
49+
} );
5050
</code></pre>
5151
<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>
5252
</longdesc>
5353
<note id="global-ajax-event" type="additional" data-title="ajaxSuccess"/>
5454
<note id="ajax-global-false" type="additional" data-title="ajaxSuccess"/>
5555
<example>
5656
<desc>Show a message when an Ajax request completes successfully.</desc>
57-
<code><![CDATA[
58-
$( document ).on( "ajaxSuccess< function( event, request, settings ) {
59-
$( "#msg" ).append( "<li>Successful Request!</li>" );
60-
} );
61-
]]></code>
57+
<pre><code>
58+
$( document ).on( "ajaxSuccess", function( event, request, settings ) {
59+
$( "#msg" ).append( "<li>Successful Request!</li>" );
60+
} );
61+
</code></pre>
6262
</example>
6363
<category slug="ajax/global-ajax-event-handlers"/>
6464
<category slug="version/1.0"/>

0 commit comments

Comments
 (0)