How to use ajaxSuccess() Method in JQuery AJAX

In this article, I will explain use of ajaxSuccess() Method in JQuery AJAX.
  • 2078

JQuery AJAX ajaxSuccess() Method

  • ajaxSuccess() method add a function to run when an AJAX requests is successfully complete.
  • ajaxSuccess() method is a AJAX Event.

Syntax

$(selector).ajaxSuccess(function(event,xhr,options))

function(event,xhr,options)  The function is run when the request is succeed.
 parameters:

  • event - Event parameter contains the event object.

  • xhr - xhr parameter contains the XMLHttpRequest object.

  • options - option parameter contains the options used in the AJAX request.


Example

 

The following example show the use of ajaxSuccess() method.

 

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function () {

        $("div").ajaxSuccess(function () {

            alert("All AJAX request successfully completed");

        });

        $("button").click(function () {

            $("div").load("jquery_ajax_demo.txt");

        });

    });

</script>

</head>

<body>

<div><h2>ajaxSuccess() Method Example</h2></div>

<button>click for change article text</button>

</body>

</html>

Output

success.jpg 

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2013 dotNetheaven. All rights reserved.