ajaxComplete() in jQuery

.ajaxComplete() : This jQuery mthod is used to register a handler to be called when Ajax requests completed.
Whenever an Ajax request completes, jQuery triggers the ajaxComplete event and all handlers that have been registered with the .ajaxComplete() method are executed at this time.

Syntax :

$(document).ajaxComplete( )


 <title>ajaxComplete() Example</title>
 <link href="Content/bootstrap.css" rel="stylesheet" />
 <script src="Scripts/jquery-1.9.1.js"></script>
 <script type="text/javascript" language="javascript">
 $(document).ready(function () {

 $("#btnSubmit").click(function (event) {

 $(document).ajaxComplete(function (event, request, settings) {
 $("#Step2").html('ajaxComplete() request has completed.');

<body style="margin:100px"> 
 <div id="step1" class="bg-danger">
 Step - 1
 <br />
 <div id="Step2" class="bg-success">
 Step - 2
 <br />
 <input type="button" class="bg-primary" id="btnSubmit" value="Submit" />


Result : When click on Submit button in step1 div has html ‘Submit button has clicked.’ ‘ Step1.html page will load in step1 div and step2 div has html that  ‘
ajaxComplete() called’.




Leave a Reply

Your email address will not be published. Required fields are marked *