LoginSignup
1
0

More than 5 years have passed since last update.

JQuery Ajax Events

Posted at

Local events

$.ajax() のオプションでハンドラを渡すパターン。

 $.ajax({
   beforeSend: function(){
     // Handle the beforeSend event
   },
   complete: function(){
     // Handle the complete event
   }
   // ......
 });

Global events

全 DOM 要素に送られてくる event。 bind() でハンドラをくっつける。

 $("#loading").bind("ajaxSend", function(){
   $(this).show();
 }).bind("ajaxComplete", function(){
   $(this).hide();
 });

ref. http://docs.jquery.com/Ajax_Events

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0