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:
Parameters | Description |
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>通過(guò) AJAX 改變文本</h2></div> <button>改變內(nèi)容</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>
Click the "Run instance" button to view the online instance