JavaScript
$(document).ajaxStop( yourFunction );
Html
<html>
<!-- heading -->
<head>
<meta charset="utf-8">
<title>Example</title>
</head>
<!-- page -->
<body>
<!-- connect the library jQuery -->
<script src="https://dir.by/example_lib/jquery/jquery-3.3.1.min.js"></script>
<!-- HTML Elements -->
<button onclick='run1();'>My button</button>
<!-- JavaScript -->
<script>
function run1()
{
// send ajax query
$.ajax(
{
type: "POST",
url: "https://dir.by",
data:{ },
success: function(msg)
{
alert(msg);
}
});
}
// event ajaxStop will start when will be finished any query ajax
$(document).ajaxStop( function ()
{
alert("my axaj finished");
});
</script>
</body>
</html>