Ajax

English [ˈeɪˌdʒæks] American [ˈeˌdʒæks]

n. The full name is "Asynchronous JavaScript and XML" (asynchronous JavaScript and XML); refers to a A web development technology for creating interactive web applications. ;Ajax copper-tin-lead bearing alloy, Yajis explosive

complete

UK[kəmˈpli:t] US[kəmˈplit]

adj .Complete; completed; (for emphasis) complete; reaching the end

vt. Complete, complete; complete or end; fill in (form)

ajax ajaxComplete() method syntax

Function: ajaxComplete() method executes the function when the AJAX request is completed. It is an Ajax event. Unlike ajaxSuccess(), functions specified through the ajaxComplete() method run when the request completes, even if the request was not successful.

Syntax: .jQueryajaxComplete(function(event,xhr,options))

Parameters:

ParametersDescription
function(event,xhr,options) Required. Specifies a function to run when the request completes. Additional parameters: event - contains the event object xhr - contains the XMLHttpRequest object options - contains the options used in the AJAX request.

Description: The XMLHttpRequest object and settings are passed as parameters to the callback function.

ajax ajaxComplete() method example

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("#txt").ajaxStart(function(){
    $("#wait").css("display","block");
  });
  $("#txt").ajaxComplete(function(){
    $("#wait").css("display","none");
  });
  $("button").click(function(){
    alert("加载完成");
    $("h2").text("文本加载完成");
  });
});
</script>
</head>

<body>

<div id="txt"><h2>通过 AJAX 改变文本</h2></div>
<button>改变内容</button>
<div id="wait" style="display:none;width:69px;height:89px;border:1px solid black;position:absolute;top:50%;left:50%;padding:2px;">
<img src='http://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg' width="64" height="64" />
<br />加载中 ...
</div>

</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance