<!DOCTYPE html>
<html>
<head>
<title>jQuery ajaxSuccess() event method</title>
<script src="jquery-latest.min.js"></script>
<script>
$(document).ready(function() {
var count = 0;
$("button").click(function(event){
$("#msg").load('ajaxfile.html');
});
$(document).ajaxStart(function(){
count++;
$("#start").text("Start Count: " + count );
});
$(document).ajaxSuccess(function(){
count++;
$("#success").text("Success Count: " + count );
});
$(document).ajaxComplete(function(){
count++;
$("#complete").text("Complete Count: " + count );
});
$(document).ajaxStop(function(){
count++;
$("#stop").text("Stop Count: " + count );
});
});
</script>
</head>
<body>
<p id="start">ajaxStart</p>
<p id="success">ajaxSuccess</p>
<p id="complete">ajaxComplete</p>
<p id="stop">ajaxStop</p>
<button>Click here to call ajaxSuccess() method</button>
<br /><br />
<div id="msg" style="background-color:pink;">First paragraph start here</div>
</body>
</html>