jQuery ajaxSuccess() Method

jQuery ajaxSuccess() method to be called when the AJAX request completes successfully.

When an Ajax request completes successfully jQuery triggers the ajaxSuccess event.


Here is a syntax for ajaxSuccess() method

$(selector).ajaxSuccess( function(event, jqXHR, options) );
Parameter Type Description
function(event, jqXHR, options) Function Required. A specifies callback function to be run when the request completes successfully.
Additional parameters
  • event - contains standard event object
  • jqXHR - contains the XMLHttpRequest object
  • options - contains plain object used in the AJAX request


    <p>Ajax is use to jQuery to open URL documents with in the documents</p>
    <br />
    <p>AJAX = Asynchronous JavaScript and XML</p>

Here, in this example ajaxSuccess() method call when click on button.

<!DOCTYPE html>
  <title>jQuery ajaxSuccess() event method</title>
  <script src="jquery-latest.min.js"></script>
    $(document).ready(function() {
      var count = 0;
        $("#start").text("Start Count: " + count );
        $("#success").text("Success Count: " + count );
        $("#complete").text("Complete Count: " + count );
        $("#stop").text("Stop Count: " + count );
  <p id="start">ajaxStart</p>
  <p id="success">ajaxSuccess</p>
  <p id="complete">ajaxComplete</p>
  <p id="stop">ajaxStop</p>
  <button>Click here to call ajaxSuccess() method</button>
  <br /><br />
  <div id="msg" style="background-color:pink;">First paragraph start here</div>

Run it...   »