개요
- jQuery Ajax Events
- Ajax 요청시 다양한 이벤트를 생성함
- 로컬 이벤트와 글로벌 이벤트로 나눌 수 있음
로컬 이벤트
- Ajax 요청 객체 안에서의 콜백
$.ajax({
beforeSend: function(){
// Handle the beforeSend event
},
complete: function(){
// Handle the complete event
}
// ......
});
글로벌 이벤트
- document에 의해 동작이 시작됨
$(document).bind("ajaxSend", function(){
$("#loading").show();
}).bind("ajaxComplete", function(){
$("#loading").hide();
});