Home >>jQuery Tutorial >jQuery ajaxStop() Method

jQuery ajaxStop() Method

jQuery ajaxStop() Method

jQuery ajaxStop() method in jQuery is used to specifies a function to run when ALL AJAX requests have completed.

Syntax:
$(document).ajaxStop(function())

Parameter Values

Parameter Description
function() It is a Required parameter and is used to specifies the function to run when all AJAX requests have completed
Here is an Example of jQuery ajaxStop() Method:

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(document).ajaxStop(function(){
alert("Completed All AJAX Request");
});
$(".btn1").click(function(){
$(".box1").load("demo_ajax_load.txt");
$(".box1").load("demo_ajax_load.asp");
});
});
</script>
</head>
<body>
<div class="box1"><h2>Change this text</h2></div>
<button class="btn1">Click me to Change Content</button>
</body>
</html>

Output:

Change this text