Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery ajaxSuccess() method

jQuery ajaxSuccess() method

jQuery AJAX methods jQuery AJAX methods

Example

Trigger an alert box when an AJAX request completes successfully:

$

(

document

)

.

ajaxSuccess

(

function

(

)

{

alert

(

"

AJAX request completed

"

)

;

}

)

;

Try it »


Definition and Usage

The ajaxSuccess() method specifies a function to run when an AJAX request completes successfully.

**Note:** As of jQuery version 1.8, this method is attached only to the document.


Syntax

$(document).ajaxSuccess(

function(event,xhr,options))

Parameters Description
function(event,xhr,options) Required. Specifies the function to run if the request succeeds.
 额外的参数:       

 
  • event - Contains the event object
  • xhr - Contains the XMLHttpRequest object
  • options - Contains the options used in the AJAX request
  • |

    More examples

    Use the options parameter
    How to use the options parameter to restrict a function to AJAX requests for a specific file.


    jQuery AJAX methods jQuery AJAX methods