ajax done fail ajaxcomplete in not a function

Updated at 04-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