ajaxStart() Method - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:ajaxStart


The ajaxStart() method sets a function to be run when an AJAX request starts.


Parameter Description
function() Required. Specifies the function to run when the AJAX request starts

The following code shows how to show a "loading" indicator image when an AJAX request starts:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
        $(this).html("<img src='http://java2s.com/resources/a.png'>");
    });//www .j a va  2 s .c om

<div><h2>Let AJAX change this text</h2></div>

<button>Change Content</button>


Related Tutorials