Home >>jQuery Tutorial >jQuery ajaxSuccess() Method
jQuery ajaxSuccess() method in jQuery is used to specifies a function to be run when an AJAX request is successfully completed.
Syntax:$(document).ajaxSuccess(function(event,xhr,options))
Parameter | Description |
---|---|
function(event,xhr,options) | It is a Required parameter and is used to Specifies the function to run if the request succeeds Additional parameters:
|
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(document).ajaxSuccess(function(){
alert("Completed AJAX request successfully");
});
$(".btn1").click(function(){
$(".txt").load("demo_ajax_load.txt");
});
});
</script>
</head>
<body>
<div class="txt"><h2>Change this text</h2></div>
<button class="btn1">Click me to Change Content</button>
</body>
</html>