Javascript examples for jQuery Method and Property:ajaxSuccess
The ajaxSuccess() method sets a function to be run when an AJAX request is successfully completed.
Parameter | Description |
---|---|
function(event,xhr,options) | Required. |
Additional parameters:
The following code shows how to trigger an alert box when an AJAX request completes successfully:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $(document).ajaxSuccess(function(){ console.log("AJAX request successfully completed"); });/*w ww.j a va 2s.c om*/ $("button").click(function(){ $("div").load("demo_ajax_load.txt"); }); }); </script> </head> <body> <button>test</button> </body> </html>