Copy codeThe Code is as follows:
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> jQuery Ajax-AjaxEvent </title>
<Script src = "../jquery-1.4.3.js" type = "text/javascript"> </script>
<Script type = "text/javascript">
$ (Document). ready (function ()
{
$ ("# BtnAjax"). bind ("click", function (event)
{
$. Get ("Default. aspx", {"resultType": "dddd"}, function (data) {$ ("# divResult" pai.html (Date );});
})
// Execute the function when the AJAX request is complete
$ ("# DivResult "). ajaxComplete (function (evt, request, settings) {$ (this ). append ('<div> ajax execution completed </div> <br/> ');})
// Execute the function when an error occurs in the AJAX request
$ ("# DivResult "). ajaxError (function (evt, request, settings) {$ (this ). append ('<div> ajax execution error </div> <br/> ');})
// Execute the function before sending an AJAX request
$ ("# DivResult "). ajaxSend (function (evt, request, settings) {$ (this ). append ('<div> before ajax execution and sending </div> <br/> ');})
// Execute the function at the beginning of the AJAX request
$ ("# DivResult "). ajaxStart (function () {$ (this ). append ('<div> ajax start execution </div> <br/> ');})
// Execute the function at the end of the AJAX request
$ ("# DivResult "). ajaxStop (function () {$ (this ). append ('<div> ajax execution ended </div> <br/> ');})
// Execute the function when the AJAX request is successful
$ ("# DivResult "). ajaxSuccess (function (evt, request, settings) {$ (this ). append ('<div> ajax execution succeeded </div> <br/> ');})
});
</Script>
</Head>
<Body>
<Br/> <button id = "btnAjax"> send Ajax requests </button> <br/>
<Div id = "divResult"> </div>
</Body>
</Html>