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();
});