jQuery > Ajax methods

.ajaxComplete() - Knowing ajax request is complete in jQuery

How to know when ajax request is complete in jQuery?


To know if the ajax request is complete, ajaxComplete() method can be used.

 <script>
        $(document).ajaxComplete(function () {
            v++;
            $("#divAjaxComplete").html("ajaxComplete: ajax request completed : ");
        });
    </script>

In the above code snippet, when ajax request is complete “ajaxComplete – ajax request complted :” is written inside “divAjaxComplete” element.

Note that this event executes after .ajaxSuccess() event. We can catch this event to show a final message or perform any activity.

Important

Note that this event fires irrespective of ajax request completed successfully or it error out.

 Views: 6766 | Post Order: 115



Write for us






Hosting Recommendations