jQuery Tutorial Tutorials - jQuery .ajaxSuccess()

jQuery .ajaxSuccess()

The .ajaxSuccess() method in jQuery is used to attach a function to be executed whenever an Ajax request completes successfully.

jQuery .ajaxSuccess() syntax

.ajaxSuccess(handler)

handler is a function to be invoked.

jQuery .ajaxSuccess() example

example

Show a message when an Ajax request completes successfully.
HTML

<button id="ajaxReq">Ajax Request</button>
<div id="result"></div>
<div id="msg"></div>

jQuery

$( "#ajaxReq" ).click(function() {
    $( "#result" ).load( "/res/test/ajax/1.html" );
});
$( document ).ajaxSuccess(function() {
    $( "#msg" ).append( "<p>Triggered ajaxSuccess handler</p>" );
});

Try now

Date:2019-08-30 02:51:10 From:www.Lautturi.com author:Lautturi