What is the ajaxSuccess() method in jQuery?

Overview

In jQuery, the ajaxSuccess() method is used to specify a function that runs when an AJAX request gets completed successfully.

Syntax

$(document).ajaxSuccess(function(event, xhr, options));

Parameters

This method accepts a mandatory function as an argument, which accepts the following parameters:

  • event—the event object
  • xhr—the instance of XMLHttpRequest object
  • options—the options used in the AJAX request

Example

Console
Example of ajaxSuccess() method

Explanation

We click Get Product Data and make an AJAX request to get product details:

https://reqres.in/api/products 

The ajaxSuccess() method is invoked when the AJAX request completes successfully.

Free Resources