How to use ajaxComplete() Method in JQuery AJAX
In this article, I will explain use of ajaxComplete () Method in JQuery AJAX.
JQuery AJAX ajaxComplete() Method
-
ajaxComplete() is implement as a method of jquery object.
-
ajaxComplete() add a function to be executed when the AJAX request completes.
-
After ajaxComplete() success and error callbacks are executed.
-
ajaxComplete() method is a AJAX Event.
Syntax
$(selector).ajaxComplete(function(event,xhr,options))
|
function(event,xhr,options) The function is run when the request completes.
parameters:
Example
The following example show the use of ajaxComplete() method.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery.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 () {
$("#txt").load("jquery_ajax_demo.txt");
});
});
</script>
</head>
<body>
<div id="txt"><h2>ajaxComplete() method example</h2></div>
<button>click for change article text</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='WaitingBig.gif' width="64" height="64" /><br />Loading..</div>
</body>
</html>
|
Output
You may also want to read these related articles Click here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here