jQuery ajaxStart() Method

jQuery ajaxStart() method to be called first before the AJAX request begin to send.

When an Ajax request to be sent, jQuery checks whether there are any pending Ajax requests. If none of requests pending then jQuery triggers the ajaxStart event.


Here is a syntax for ajaxStart() method

$(selector).ajaxStart( function() );
Parameter Type Description
function() Function Required. A specifies callback function to be run when the AJAX request starts.


    <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 ajaxStart() method call when click on button.

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

Run it...   »