jQuery ajaxComplete() 메서드
예시
AJAX 요청이 진행되는 동안 "로드 중" 표시기 이미지를 표시합니다.
$(document).ajaxStart(function(){
$("#wait").css("display", "block");
});
$(document).ajaxComplete(function(){
$("#wait").css("display", "none");
});
정의 및 사용
ajaxComplete() 메서드는 AJAX 요청이 완료될 때 실행할 함수를 지정합니다.
참고: jQuery 버전 1.8부터 이 메서드는 문서에만 첨부되어야 합니다.
ajaxSuccess()와 달리 ajaxComplete() 메서드로 지정된 함수는 요청이 성공하지 않더라도 요청이 완료되면 실행됩니다.
통사론
$(document).ajaxComplete(function(event,xhr,options))
Parameter | Description |
---|---|
function(event,xhr,options) |
Required. Specifies the function to run when the request completes Additional parameters:
|