Latest web development tutorials

jQuery ajaxComplete () method

jQuery AJAX Methods jQuery AJAX Methods

Examples

Show "loading" indication when the AJAX request is in progress:

$(document).ajaxStart(function(){
$("#wait").css("display","block");
});
$(document).ajaxComplete(function(){
$("#wait").css("display","none");
});

try it"

Definition and Usage

ajaxComplete () method specifies AJAX request functions run when completed.

Note: Since jQuery version 1.8 onwards, this method is only attached to the document.

Unlike ajaxSuccess (), () function method prescribed will run when the request is completed by ajaxComplete, even if the request was not successful.


grammar

$(document).ajaxComplete(function(event,xhr,options))

参数 描述
function(event,xhr,options) 必需。规定当请求完成时运行的函数。
额外的参数:
  • event - 包含 event 对象
  • xhr - 包含 XMLHttpRequest 对象
  • options - 包含 AJAX 请求中使用的选项


jQuery AJAX Methods jQuery AJAX Methods