ajax done fail ajaxcomplete in not a function

Created at 05-Mar-2022 , By samar

ajax done fail ajaxcomplete in not a function

Through many examples, we will learn how to resolve the "ajax done fail ajaxcomplete in not a function".

Method .ajaxcomplete() is deprecated in the latest version of jQuery. Use .always() method to get the response of ajax request. Which is used to get the response after the ajax request is completed.
  • Ajax request with .always() method

    <script> 
    $.ajax( ...params... )
    .always(function(jqXHR, textStatus) {
        if (textStatus != "success") {
            alert("Error: " + jqXHR.statusText); //error is always called .statusText
        } else {
            alert("Success: " + jqXHR.response); //might not always be named .response
        }
        alert('AJAX call complete');
    }); 
    </script>
    

Back to code snippet queries related jquery

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.