Skip to content

Commit ca266fb

Browse files
poloniculmovdmethvin
authored andcommitted
Ref jquerygh-240; jQuery 1.9 wants document for ajax events. Close jquerygh-285.
Updated the example to reflect the change in jQuery 1.9. dmethvin: changed "broadcast" to "trigger" event terminology.
1 parent 8125dbb commit ca266fb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pages/Ajax_Events.html

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"title": "Ajax Events"
44
}
55
</script>
6-
<p>Ajax requests produce a number of different events that you can subscribe to. Here's a full list of the events and in what order they are broadcast.</p>
6+
<p>Ajax requests produce a number of different events that you can subscribe to. Here's a full list of the events and in what order they are triggered.</p>
77
<p>There are two types of events:</p>
88
<h3>Local Events</h3>
99
<p>These are callbacks that you can subscribe to within the Ajax request object, like so:</p>
@@ -18,11 +18,11 @@ <h3>Local Events</h3>
1818
});
1919
</code></pre>
2020
<h3>Global Events</h3>
21-
<p>These events are broadcast to all elements in the DOM, triggering any handlers which may be listening. You can listen for these events like so:</p>
22-
<pre> $("#loading").bind("ajaxSend", function(){
23-
$(this).show();
21+
<p>These events are triggered on the <code>document</code>, calling any handlers which may be listening. You can listen for these events like so:</p>
22+
<pre> $(document).bind("ajaxSend", function(){
23+
$("#loading").show();
2424
}).bind("ajaxComplete", function(){
25-
$(this).hide();
25+
$("#loading").hide();
2626
});
2727
</pre>
2828
<p>Global events can be disabled for a particular Ajax request by passing in the global option, like so:</p>
@@ -33,10 +33,10 @@ <h3>Global Events</h3>
3333
});
3434
</code></pre>
3535
<h3>Events</h3>
36-
<p>This is the full list of Ajax events that are broadcast, and in the order in which they are broadcast. The indented events are broadcast for each and every Ajax request (unless a global option has been set). The ajaxStart and ajaxStop events are events that relate to all Ajax requests together.
36+
<p>This is the full list of Ajax events , and in the order in which they are triggered. The indented events are triggered for each and every Ajax request (unless a global option has been set). The ajaxStart and ajaxStop events are events that relate to all Ajax requests together.
3737
</p>
3838
<ul>
39-
<li> <b>ajaxStart</b> (Global Event)<br>This event is broadcast if an Ajax request is started and no other Ajax requests are currently running.
39+
<li> <b>ajaxStart</b> (Global Event)<br>This event is triggered if an Ajax request is started and no other Ajax requests are currently running.
4040
<ul>
4141
<li> <b>beforeSend</b> (Local Event)<br>This event, which is triggered before an Ajax request is started, allows you to modify the XMLHttpRequest object (setting additional headers, if need be.)</li>
4242
<li> <b>ajaxSend</b> (Global Event)<br>This global event is also triggered before the request is run.</li>

0 commit comments

Comments
 (0)