Asked 3 years ago
24 Jun 2021
Views 669
Era

Era posted

How to Execute the function after Ajax call is complete

How to Execute the function after Ajax call is complete
ching

ching
answered Apr 28 '23 00:00

To execute a function after an AJAX call is complete in jQuery, you can use the . done () method or the success callback option. Here is an example using the . done () method:



$.ajax({
  url: "your_url",
  success: function(data) {
    // Your code here
  }
}).done(function() {
  // Your function to execute after the AJAX call is complete
});

Alternatively, you can use the success callback option:



$.ajax({
  url: "your_url",
  success: function(data) {
    // Your code here
  },
  complete: function() {
    // Your function to execute after the AJAX call is complete
  }
});

Both of these methods will execute your function after the AJAX call is complete. You can replace your function to execute with your actual function name or code.
Post Answer